Ⅰ 在Access2003中用sql創建這個表 創建一個「雇員」表,包括雇員號、姓名、性別、出生日期、部門、備注欄位
create table 雇員(
num varchar(10) primary key,
name varchar(10),
sex varchar(2),
);
就在查詢框里寫,然後執行就行了。應該就可以,沒裝Acess2003 ,你自己試試吧!希望有幫助!
Ⅱ 如何用SQL創建一個表格
1、打開SQL Server,在資料庫處,右鍵資料庫,點擊新建資料庫。
Ⅲ 編寫SQL語句
1,建立表
create table Employees
(
ssn varchar(50) Not null unique,
name varchar(200),
sex char(2) check (sex='男' or sex='女'),
age int check ( age>0),
Department varchar(50)
)
2,插入數據
insert into Employees (ssn,name,sex,age,department)
values('07216008','笑笑','女',24,'cs')
3,修改
update Employees set age=26 where name='笑笑' and ssn='07126008'
4,查詢
select name,sex,department from Employees
5 授權
grant select on Employees to simon with grant option
Ⅳ Test資料庫中,用T-SQL語句創建員工工資表,各列的要求如 下表所示
CREATE TABLE [dbo].[員工工資表](
[NO] [int] NOT NULL,
[Xm] [varchar](30) NOT NULL,
[Gz] [decimal](8, 2) NULL,
[YwJj] [decimal](8, 2) NULL,
[Sds] [decimal](8, 2) NULL,
[SfGz] AS (([Gz]+[YwJj])-[Sds]),
CONSTRAINT [PK_員工工資表] PRIMARY KEY CLUSTERED
(
[NO] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'編號、主鍵' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'NO'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'Xm'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'工資' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'Gz'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'業務獎金' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'YwJj'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'所得稅' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'Sds'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'實發=Gz+YwJj-Sds' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'員工工資表', @level2type=N'COLUMN',@level2name=N'SfGz'
Ⅳ 建立三張表:雇員表、部門表、工作表。
create database work on ( NAME=work1, FILENAME='e:\data1.mdf', SIZE=1 MB, MAXSIZE=UNLIMITED, FILEGROWTH=15% ) LOG ON ( NAME=work2, FILENAME='d:\wordlog.ldf', SIZE=1 MB, MAXSIZE=UNLIMITED, FILEGROWTH=15% )GOCREATE TABLE gyb(gyh Varchar(4) not null primary key, xm Char(8) not null, nl SmallInt check(nl>18 and nl<55), dz Varchar(10) null , xs int check(xs >1000 and xs<50000))goCREATE TABLE bmb(bmh Char(4) not null primary key, bmm Nvarchar(5) not null unique, bmjl Varchar(8) not null)goCREATE TABLE gzb(gyh Char(4) not null primary key, bmh Char(4) not null references bmb(bmh), gznx SmallInt)這是sql2000的,直接把上面代碼復制到查徇分析器中運行就可以了,關閉查徇分析器時它會提示你保存,保存成.sql,OK。