当前位置:网站首页>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 :



边栏推荐
- 【MPC】①二次规划问题MATLAB求解器quadprog
- 网站源码整站下载 网站模板源代码下载
- 12.Gateway新一代网关
- Valgrind usage of memory leak locating tool
- flutter path_provider: ^2.0.10可以获取临时目录
- C# 一行代码计算文件的MD5值 - CodePlus系列
- bash: ln: command not found
- 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;
- C one line code calculates the MD5 value of the file - codeplus series
- 数字藏品新一轮热度开启
猜你喜欢

新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求

【Matytype】在CSDN博客中插入Mathtype行间与行内公式

数字藏品新一轮热度开启

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

bash: ln: command not found

零基础入门测试该学什么?最全整理,照着学就对了

In the new database era, don't just learn Oracle and MySQL

零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)

基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建

JS基础--数据类型
随机推荐
Prism journal navigation button usability exploration record
IDEA运行报错Command line is too long. Shorten command line for...
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
毕业季·进击的技术er
Submission lottery - light application server essay solicitation activity (may) award announcement
C# 一行代码计算文件的MD5值 - CodePlus系列
Wireshark TS | 快速重传和乱序之混淆
移动硬盘驱动器读到,但不显示盘符
【Matytype】在CSDN博客中插入Mathtype行间与行内公式
Matplotlib数据可视化基础
Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
JS基础--数据类型
Does anyone know the logic of limit statement execution in Clickhouse? In the picture, the SQL above can be executed successfully
Project0:小游戏
Addition, deletion, modification and query of database
prism journal导航按钮的可用性探索记录
442. 数组中重复的数据
What if the win11 account is locked and unable to log in? Win11 account is locked and unable to log in
基金国际化的发展概况