当前位置:网站首页>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 :
边栏推荐
- [.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
- Is it safe to buy funds on the access letter?
- Want to open an account, is it safe to open an account of Huatai Securities online?
- How do clients request databases?
- 关于#数据库#的问题:GBase 8s中如何避免死锁
- 问下群里的各位,有使用flink oracle cdc的logminer方案,在生产上稳定运行的实际
- Which securities company has a low, safe and reliable Commission for stock trading and account opening
- What legal risks and qualifications should be paid attention to when building a digital collection platform?
- A new round of popularity of digital collections opens
- Does anyone know why? The table structure is the source table MySQL CDC that has just been directly copied
猜你喜欢
零基础入门测试该学什么?最全整理,照着学就对了
What a high commission! The new programmer's partner plan is coming. Everyone can participate!
Rising stars in Plant Sciences (rsps2022) final Science Lecture (6.30 pm)
SQLAchemy 常用操作
Japanese professor sues Intel FPGA and SOC products for infringing a design patent
C [byte array] and [hexadecimal string] mutual conversion - codeplus series
[encounter Django] - (II) database configuration
基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建
The exclusive collection of China lunar exploration project is limited to sale!
C# 一行代码计算文件的MD5值 - CodePlus系列
随机推荐
Error: missing revert data in call exception
New situation of digital collection market
106. construct binary tree from middle order and post order traversal sequence
亿学学堂帮个人开的证券账户安全吗?是不是有套路
Want to open an account, is it safe to open an account of Huatai Securities online?
SQL Server列一相同的情况下,如何取列二的最大值,并重新生成表
Introduction of uniapp wechat applet components on demand
【Laravel 】faker数据填充详解
基金管理人的内部控制
Is it safe to buy funds on the access letter?
mysql cdc能把能把op字段拿出来吗
程序员都想去国企?技术落后薪资低,躺平几年出来都找不到工作...
Suggest collecting | what to do when encountering slow SQL on opengauss?
[encounter Django] - (II) database configuration
What if the win11 account is locked and unable to log in? Win11 account is locked and unable to log in
Project0: Games
About database: how to avoid deadlock in gbase 8s
CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
Crawler (2) - requests (1) | deep parsing of requests module
flutter Uint8List格式的图片和File格式图片的互相转换