当前位置:网站首页>Database experiment report (I)
Database experiment report (I)
2022-07-01 10:46:00 【Billy Miracle】
One 、 The experiment purpose
Understand and master the database DDL Language , Able to use SQL DDL Statement to create, modify and delete the database 、 Patterns and tables .
Two 、 Experimental content
use SQL Define a statement to create a table that meets the following conditions C-1 To C-4( Pay attention to various integrity constraints )
surface C-1 Student Table structure
Name explain data type constraint
Sno Student number Regular encoded fixed length string , The length is 7 Primary key
Sname full name Regular encoded fixed length string , The length is 10
Ssex Gender Regular encoded fixed length string , The length is 2
Sage Age Microinteger (tinyint)
Sdept Department Ordinary encoded indefinite length string , The length is 20
Sid ID number Regular encoded fixed length string , The length is 10
Sdate Date of admission date
surface C-2 Course Table structure
Name explain data type constraint
Cno Course no. Regular encoded fixed length string , The length is 10 Primary key
Cname Course name Ordinary encoded indefinite length string , The length is 20
Credit Class hours integer
Semester credits Small integer
surface C-3 SC Table structure
Name explain data type constraint
Sno Student number Regular encoded fixed length string , The length is 7 Primary key , quote Student The foreign key
Cno Course no. Regular encoded fixed length string , The length is 10 Primary key , quote Course The foreign key
Grade achievement Small integer
surface C-4 Teacher Table structure
Name explain data type constraint
Tno Teacher number Regular encoded fixed length string , The length is 8
Tname Teacher's name Regular encoded fixed length string , The length is 10
Salary Wages Fixed point decimals , Before the decimal point 4 position , After the decimal point 2 position
surface C-1 Student Table data
Student number full name Gender Age Is don't ID number Date of admission
0811101 Li Yong male 21 Department of Computer Science
0811102 Liu Chen male 20 Department of Computer Science
0811103 Wang min. Woman 20 Department of Computer Science
0811104 Zhang Xiaohong Woman 19 Department of Computer Science
0821101 Zhang Li male 20 Information management department
0821102 Wu Bin Woman 19 Information management department
0821103 Zhang Hai male 20 Information management department
0831101 Qian Xiaoping Woman 21 Department of communication engineering
0831102 Wang Dali male 20 Department of communication engineering
0831103 Zhang Shanshan Woman 19 Department of communication engineering
surface C-2 Course The records in the table
Cno Cname Credit Semester
C001 Advanced mathematics 4 1
C002 College English 3 1
C003 College English 3 2
C004 Computer culture 2 2
C005 VB 2 3
C006 Database foundation 4 5
C007 data structure 4 4
C008 computer network 4 4
surface C-3 SC The records in the table
Sno Cno Grade
0811101 C001 96
0811101 C002 80
0811101 C003 84
0811101 C005 62
0811102 C001 92
0811102 C002 90
0811102 C004 84
0821102 C001 76
0821102 C004 86
0821102 C005 73
0821102 C007 NULL
0821103 C001 50
0821103 C004 80
0831101 C001 50
0831101 C004 80
0831102 C007 NULL
0831103 C004 78
0831103 C005 65
0831103 C007 NULL
surface C-4 Teacher The records in the table
Tno Tname Salary
T001 Zhang MEIXIA 5000
T002 Wang Honglin 5500
T003 Lilifen 4800
T004 Zhou Liangshui 6000
T005 Wu Xiang 7000
3、 ... and 、 Experimental environment
MySQL、Navicat 15 for MySQL
Four 、 Preparation before experiment
experimental data , Written in the experimental content .
5、 ... and 、 The experimental steps
Create the database first :
Creat Database
Next, create a student table :
Create schedule :
Create a course selection list , And two foreign keys (Foreign Key), Separate Association student Tabular Sno and course Tabular Cno:
Create a teacher list :
Next, let's look at the design of each table :



Next, add data :
Because there are two columns of student table data without , So write each value The corresponding column .
Schedule data :
Course selection table data :
Teacher table data :
Next, I practiced a few operations about users :
Constrained learning :
Put the learned code directly :







6、 ... and 、 experimental result
student、course、sc、teacher Several tables are created , Expect the data to be added successfully .
Use of integrity : Use primary key constraint when creating 
Change student name , Make it non empty :



边栏推荐
- Sqlachemy common operations
- 选择在中金证券上炒股开户可以吗?安全吗?
- 12款大家都在用的产品管理平台
- 零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
- Suggest collecting | what to do when encountering slow SQL on opengauss?
- Introduction of uniapp wechat applet components on demand
- 内存泄漏定位工具之 valgrind 使用
- 内存泄漏定位工具之 valgrind 使用
- IDEA运行报错Command line is too long. Shorten command line for...
- 投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
猜你喜欢

106. construct binary tree from middle order and post order traversal sequence
![[.net6] use ml.net+onnx pre training model to liven the classic](/img/b3/b117481fba7257453011e4cdb1eaaa.png)
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B

【邂逅Django】——(二)数据库配置

What should I learn in the zero foundation entry test? It's the most comprehensive. Just learn from it

缺少比较器,运放来救场!(运放当做比较器电路记录)

Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)

Submission lottery - light application server essay solicitation activity (may) award announcement

JD and Tencent renewed the three-year strategic cooperation agreement; The starting salary rose to 260000 yuan! Samsung sk of South Korea competes for salary increase to retain semiconductor talents;

Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB

个人商城二开逍遥B2C商城系统源码-可商用版/拼团拼购优惠折扣秒杀源码
随机推荐
Suggest collecting | what to do when encountering slow SQL on opengauss?
数字藏品平台搭建需要注意哪些法律风险及资质?
[matytype] insert MathType inter line and intra line formulas in CSDN blog
Mobile hard drive reads but does not display drive letter
[dark horse morning post] Yu Minhong said he never looked at the stock price of New Oriental; Hengchi 5 will start pre-sale in July; Naixue virtual stock or suspected of illegal fund-raising; From Jul
Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
CentOS configures discuz prompt, please check whether the MySQL module is loaded correctly
关于#SQL#的问题,如何解决?
12 product management platforms that everyone is using
Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
内存泄漏定位工具之 valgrind 使用
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
C [byte array] and [hexadecimal string] mutual conversion - codeplus series
How to solve the problem of SQL?
Ask everyone in the group about the fact that the logminer scheme of flick Oracle CDC has been used to run stably in production
CRC 校验
MySQL common commands
有大佬知道这是为啥吗?表结构都是刚直接复制的源表 mysql-cdc
Button button clear border
【论文阅读】Trajectory-guided Control Prediction for End-to-end Autonomous Driving: A Simple yet Strong Ba