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



边栏推荐
- 【Matytype】在CSDN博客中插入Mathtype行间与行内公式
- How to solve the problem of SQL?
- Kotlin coprocessor scheduling switch threads it's time to unravel the truth
- . Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
- 【邂逅Django】——(二)数据库配置
- MySQL常用命令
- Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
- Design and practice of new generation cloud native database
- 华为HMS Core携手超图为三维GIS注入新动能
- CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
猜你喜欢

Japanese professor sues Intel FPGA and SOC products for infringing a design patent

CRC verification

12. Gateway new generation gateway

Matplotlib数据可视化基础

商城小程序源码开源版-可二开

【MPC】①二次规划问题MATLAB求解器quadprog

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

数字藏品市场新局面

. Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks

Sqlachemy common operations
随机推荐
678. Valid bracket string
Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years
基金国际化的发展概况
投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
Handling distributed transactions with powerful dbpack (PHP tutorial)
How to get the maximum value of column two and regenerate the table when the SQL Server column one is the same
NC | 肠道细胞和乳酸菌共同作用来防止念珠菌感染
Design and practice of new generation cloud native database
What should I learn in the zero foundation entry test? It's the most comprehensive. Just learn from it
IDEA运行报错Command line is too long. Shorten command line for...
442. duplicate data in array
内存泄漏定位工具之 valgrind 使用
442. 数组中重复的数据
Daily mathematics serial 55: February 24
Project0: Games
Venv: directory structure of venv
flutter Uint8List格式的图片和File格式图片的互相转换
Rising Stars in Plant Sciences (RSPS2022) Finalist科学演讲会(6.30晚9点)
SQL SERVER2014删除数据库失败,报错偏移量0x0000...
爬虫(2) - Requests(1) | Requests模块的深度解析