From e8ce212c2beb337198001d07fea9cedc5aa1bb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:00:20 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E5=88=98=E6=B0=B8?= =?UTF-8?q?=E6=BD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\345\210\230\346\260\270\346\275\230/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\345\210\230\346\260\270\346\275\230/.keep" diff --git "a/\345\210\230\346\260\270\346\275\230/.keep" "b/\345\210\230\346\260\270\346\275\230/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 5f30bf8ea042fe41c144e6c495a655b86d003cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:00:40 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\224\350\256\260/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/.keep" diff --git "a/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/.keep" "b/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 6bcf859e01e6268e5502cb5891f1e7912a707a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:01:10 +0000 Subject: [PATCH 3/7] =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=9816?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘永潘 <1924969174@qq.com> --- .../\347\254\224\350\256\260.txt" | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" diff --git "a/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" "b/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" new file mode 100644 index 0000000..0bf2cf1 --- /dev/null +++ "b/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" @@ -0,0 +1,79 @@ +--关系型数据库:SQL server, Mysql, Oracle + +--database:数据库 + +if exists (select * from sys.databases where name='DBTEST') +--创建数据库:create database 数据库drop(删除数据库)create(创建) + drop database DBTEST + + create database DBTEST + + --使用数据库 + use dbtest + + --创建班级表 + create table ClassInfo( + ClassId int primary key identity(1,1), + ClassName varchar(20) + ); + + --插入数据: insert [into] 表名(字段名) values(值) + insert into ClassInfo( ClassName) values('软件1班'); + + insert ClassInfo values('软件2班') + + select * from ClassInfo + + --创建数据表 + create table StuInfo( + stuId int primary key identity(1001,1), --学生ID + --添加一个检查约束,判断用户插入/新增的数据,性别字段是不是男或者女 + --default:默认约束 + --check + stugender varchar(2) not null default('男') check(stugender='男' or stugender='女'), --学生性别 + stuphone char(11) check(len(stuphone)=11) unique, + --创建班级外键 + --ClassID int references ClassInfo(ClassID) + ClassID int + + ); + + + --增加外键 + --修改表结构 表名 add constraint 约束名 foreign key(要引用的字段) references 主键表(字段) + Alter table StuInfo add constraint FK_StuInfo_ClassId foreign key(ClassID) references ClassInfo(ClassID) + + + --新增姓名列 + alter table StuInfo add stuName varchar(20) + + + + --如果没给出列名,默认是按照顺序一个个添加 + --insert StuInfo values('女',13888888888) + + --insert StuInfo(stuphone) values(15888888888) + + + + select * from StuInfo; + + --字符串:char(5),varchar(5),nvarchar(5)之间区别是什么 + + + + --删除表:drop table 表名 + drop table StuInfo + + + --非空 + + --约束,自增(标识列) + + --外键 + --主键:默认唯一列 + --默认 + --唯一: + --check检查: + + --插入数据:insert into \ No newline at end of file -- Gitee From 882748b17b132bdf8b563ff3f5ca43c518376eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:01:21 +0000 Subject: [PATCH 4/7] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E5=88=98?= =?UTF-8?q?=E6=B0=B8=E6=BD=98/=E7=AC=94=E8=AE=B0/=E7=AC=94=E8=AE=B0.txt=20?= =?UTF-8?q?=E4=B8=BA=20=E5=88=98=E6=B0=B8=E6=BD=98/=E7=AC=94=E8=AE=B0/2022?= =?UTF-8?q?-9-15=E7=AC=94=E8=AE=B0.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-9-15\347\254\224\350\256\260.txt" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" => "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/2022-9-15\347\254\224\350\256\260.txt" (100%) diff --git "a/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" "b/\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/2022-9-15\347\254\224\350\256\260.txt" similarity index 100% rename from "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/\347\254\224\350\256\260.txt" rename to "\345\210\230\346\260\270\346\275\230/\347\254\224\350\256\260/2022-9-15\347\254\224\350\256\260.txt" -- Gitee From 197b0dd422102d25f01425a08da6adb39c3d9b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:01:44 +0000 Subject: [PATCH 5/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/.keep" diff --git "a/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/.keep" "b/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 08fe8f0ecdf73951ceeed25039eca5bb04bf1016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=98?= <1924969174@qq.com> Date: Fri, 16 Sep 2022 04:01:54 +0000 Subject: [PATCH 6/7] =?UTF-8?q?=E5=88=98=E6=B0=B8=E6=BD=9816?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘永潘 <1924969174@qq.com> --- .../\344\275\234\344\270\232.sql" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" diff --git "a/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" "b/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" new file mode 100644 index 0000000..fc08cd2 --- /dev/null +++ "b/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" @@ -0,0 +1,43 @@ +CREATE DATABASE DBTEST; +USE dbtest +if exists (select * from sys.databases where name='sectionInfo') +drop table sectionInfo + +create table sectionInfo( + sectionID int primary key identity(1,1), + sectionName varchar(10) not null +); + +create table userInfo( + userNo int primary key identity(1,1) not null, + userName varchar(10) unique not null check(len(userName)>=4), + userSex varchar(2) not null check(userSex ='男' or userSex ='女'), + userAge int not null check(0 Date: Fri, 16 Sep 2022 04:02:05 +0000 Subject: [PATCH 7/7] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E5=88=98?= =?UTF-8?q?=E6=B0=B8=E6=BD=98/=E4=BD=9C=E4=B8=9A/=E4=BD=9C=E4=B8=9A.sql=20?= =?UTF-8?q?=E4=B8=BA=20=E5=88=98=E6=B0=B8=E6=BD=98/=E4=BD=9C=E4=B8=9A/2022?= =?UTF-8?q?-9-15=E4=BD=9C=E4=B8=9A.sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-9-15\344\275\234\344\270\232.sql" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" => "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/2022-9-15\344\275\234\344\270\232.sql" (100%) diff --git "a/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" "b/\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/2022-9-15\344\275\234\344\270\232.sql" similarity index 100% rename from "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/\344\275\234\344\270\232.sql" rename to "\345\210\230\346\260\270\346\275\230/\344\275\234\344\270\232/2022-9-15\344\275\234\344\270\232.sql" -- Gitee