insert into EmpTable(Name,Age,Duty,Salary) values('王明',35,'外贸总监',12500)
insert into EmpTable(Name,Age,Duty,Salary) values('李勇',24,'外贸员',6500)
insert into EmpTable(Name,Age,Duty,Salary) values('刘星',25,'外贸员',7500)
insert into EmpTable(Name,Age,Duty,Salary) values('周平',21,'外贸员',3500)
insert into EmpTable(Name,Age,Duty,Salary) values('杨兰',20,'外贸员',3000)
2.为每个职工创建数据库登录名和用户名:
这样不是很好的管理方式,可以创建一个用户表,从而设置权限。
CREATE TABLE [dbo].[Obas_SystemUser](
[Flag] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
[UserName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
[UserPassWord] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[GroupName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[CreateDate] [datetime] NULL CONSTRAINT [DF_Obas_SystemUser_CreateDate] DEFAULT (getdate()),
[CreateName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[LoginTime] [datetime] NULL,
CONSTRAINT [PK_Obas_SystemUser] PRIMARY KEY CLUSTERED
(
[UserName] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
Oracle\x0d\x0a通过 COMMENT ON TABLE / COMMENT ON COLUMN 追加表/字段的备注。\x0d\x0aCREATE TABLE "MR_DEPT" (\x0d\x0a"DEPT_ID" NUMBER NOT NULL ,\x0d\x0a"PARENT_ID" NUMBER,\x0d\x0a"DEPT_NAME" CHAR(20) NOT NULL ,\x0d\x0a"STATUS" NUMBER DEFAULT 1 NOT NULL ,\x0d\x0aPRIMARY KEY ("DEPT_ID") \x0d\x0a) \x0d\x0a/\x0d\x0aCOMMENT ON TABLE "MR_DEPT" IS '部门表'\x0d\x0a/\x0d\x0aCOMMENT ON COLUMN "MR_DEPT"."DEPT_ID" IS '部门编号'\x0d\x0a/\x0d\x0aCOMMENT ON COLUMN "MR_DEPT"."PARENT_ID" IS '上级部门编号'\x0d\x0a/\x0d\x0aCOMMENT ON COLUMN "MR_DEPT"."DEPT_NAME" IS '部门名'\x0d\x0a/\x0d\x0aCOMMENT ON COLUMN "MR_DEPT"."STATUS" IS '状态'\x0d\x0a/\x0d\x0a\x0d\x0aSQL Server 通过存储过程追加\x0d\x0aCREATE TABLE test_table(\x0d\x0a Test_ID int IDENTITY(1,1) PRIMARY KEY NOT NULL ,\x0d\x0a Test_Key varchar(10) NOT NULL ,\x0d\x0a Test_Value varchar(20) NOT NULL \x0d\x0a)\x0d\x0ago\x0d\x0a\x0d\x0aEXECUTE sp_addextendedproperty N'MS_Description', '测试表', N'user', N'dbo', N'Table', N'test_table', NULL, NULL\x0d\x0ago\x0d\x0a\x0d\x0aEXECUTE sp_addextendedproperty N'MS_Description', '主键(自增长)', N'user', N'dbo', N'Table', N'test_table', N'column' , N'Test_ID'\x0d\x0ago\x0d\x0a\x0d\x0aEXECUTE sp_addextendedproperty N'MS_Description', '种类', N'user', N'dbo', N'Table', N'test_table', N'column' , N'Test_Key'\x0d\x0ago\x0d\x0a\x0d\x0aEXECUTE sp_addextendedproperty N'MS_Description', '数值', N'user', N'dbo', N'Table', N'test_table', N'column' , N'Test_Value'\x0d\x0ago\x0d\x0a\x0d\x0aMySQL 包含在建表语句中。\x0d\x0aCREATE TABLE test_table(\x0d\x0a Test_ID int NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键(自增长)' ,\x0d\x0a Test_Key varchar(10) NOT NULL COMMENT '种类' ,\x0d\x0a Test_Value varchar(20) NOT NULL COMMENT '数值' \x0d\x0a)\x0d\x0aCOMMENT = '测试表'用insert语句插入:INSERT INTO 语句INSERT INTO 语句用于向表格中插入新的行。语法INSERT INTO 表名称 VALUES (值1, 值2,....)我们也可以指定所要插入数据的列:INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)插入新的行"Persons" 表:LastNameFirstNameAddressCitySQL 语句:
INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
SQL 语句:
INSERT INTO Persons (LastName, Address) VALUES ('Wilson', 'Champs-Elysees')
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)