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



边栏推荐
猜你喜欢

Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
![[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》](/img/b3/b117481fba7257453011e4cdb1eaaa.png)
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》

Today in history: the semiconductor war in the late 1990s; Von Neumann published the first draft; CBS acquires CNET

CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)

北汽蓝谷:业绩承压,极狐难期

12.Gateway新一代网关

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

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

华为HMS Core携手超图为三维GIS注入新动能

C one line code calculates the MD5 value of the file - codeplus series
随机推荐
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》
2022年现在在网上开通股票账户安全吗?会不会有什么危险?
678. 有效的括号字符串
新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
What legal risks and qualifications should be paid attention to when building a digital collection platform?
dotnet 控制台 使用 Microsoft.Maui.Graphics 配合 Skia 进行绘图入门
价值1000毕业设计校园信息发布平台网站源码
Introduction of uniapp wechat applet components on demand
Suggest collecting | what to do when encountering slow SQL on opengauss?
[matytype] insert MathType inter line and intra line formulas in CSDN blog
12 plateformes de gestion de produits utilisées par tout le monde
What a high commission! The new programmer's partner plan is coming. Everyone can participate!
CRC verification
零基础入行软件测试必看,10年测试老鸟的良心建议(共15条)
Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB
关于#数据库#的问题:GBase 8s中如何避免死锁
商城小程序源码开源版-可二开
Wireshark TS | confusion between fast retransmission and out of sequence
In the new database era, don't just learn Oracle and MySQL
442. 数组中重复的数据