当前位置:网站首页>Basic learning of SQL Server -- creating databases and tables with code
Basic learning of SQL Server -- creating databases and tables with code
2022-07-07 23:49:00 【Xiaobai learning software】
1. After the connection is successful, the following page appears , Then, the first step of our study is to build a database and table
2. Understand the foundation before establishing SQL Language
SQL Language is a collection of DDL、DML、DCL Integrated database language .
1)DDL Sentence guide word :Create( establish )、Alter( modify )、Drop( revoke )
Definition and deletion of patterns , Including definition Database,Table,View,Index, Integrity constraints, etc , It also includes defining objects (RowType Line object ,Type List objects )
2)DML Sentence guide word :Insert、Delete、Update,Select
Various methods of update and retrieval operation , For example, enter the record directly , From the other Table( from SubQuery establish ) Input .2. Retrieval of various complex conditions , Such as connection search 、 Fuzzy search 、 Group search 、 Nested search, etc .3. Various aggregation operations , Averaging 、 Sum up 、.. etc. , Group aggregation , Group filtering, etc
3)DCL Sentence guide word :Grant,Revoke
Security control : Authorization and revocation of authorization
3. To build a database, you need to define the database and tables ( Use DDL), Append tuples... To the table ( Use DML)
DDL:Data Definition Language
1) Create database DB The sentence used starts with :Create Database
2) establish DB Medium Table( Defining relational patterns ) Statement start :Create Table
notes : A table has at least one column
Frequently used data types
4. Example : Create course learning database SCT
notes :DBMS Create a SCT data
First step : Click new query , Input
create database SCT;
End of sentence Semicolon in English Add it or not Watching habits
The second step : Click execute ( Under new query ), The prompt appears : The command completed successfully
The third step : Select the left side database , Right click —— Select refresh —— appear SCT database
Database establishment is complete
5. establish SCT Table under database
Right click SCT database , Click new query , New SQLQuery2.sql
Enter After the command to create a table —— Click execute
Code :
create Table Student(
S# char(8) not null,
Sname char(10),
Ssex char(2),
Sage integer,
D# char(2),
Sclass char(6),
)create Table Course(
C# char(3),
Cname char(12),
Chours integer,
Credit float(1),
T# char(3),
)
single click SCT—— Refresh —— Two newly created tables appear in the table ,SCT The following table was created successfully
6. To save the code
single click Save button , Store the files in the folder you define
7. Append tuple of table
( Tuples can be understood as rows of a table )
Yes Student surface , Add Zhang San's information ( The previous code to create the table has been run , Therefore, the newly written code can be locally selected , Click on —— perform )
8. Check the contents of the table
Select... On the left Student surface —— Right click —— Edit the first two hundred lines
You can add or delete tuples directly in the table
9. Looking at the table with code
Select * from Student
The screenshot of the knowledge points in the article comes from : Netease public class app—— Database system ( Harbin Institute of Technology Speaker : Mr. Zhan Dechen )
边栏推荐
- [experiment sharing] log in to Cisco devices through the console port
- How did a fake offer steal $540million from "axie infinity"?
- UIC564-2 附录4 –阻燃防火测试:火焰的扩散
- Rock-paper-scissors
- Idea automatically generates serialVersionUID
- At the age of 35, I made a decision to face unemployment
- BSS 7230 flame retardant performance test of aviation interior materials
- SAP memory parameter tuning process
- Rectification characteristics of fast recovery diode
- 激光slam学习(2D/3D、偏实践)
猜你喜欢
串联二极管,提高耐压
Wechat applet development beginner 1
One click free translation of more than 300 pages of PDF documents
Ping error: unknown name or service
The file format and extension of XLS do not match
Interface
95.(cesium篇)cesium动态单体化-3D建筑物(楼栋)
关于CH32库函数与STM32库函数的区别
FFA and ICGA angiography
Pycharm basic settings latest version 2022
随机推荐
Interface
May day C - most
受限线性表
Rectification characteristics of fast recovery diode
Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
webflux - webclient Connect reset by peer Error
Alibaba cloud MySQL cannot connect
通达信买基金安全吗?
507 field D - extraterrestrial relics
网上买基金安全么?
Rock-paper-scissors
Slam interview summary
二叉排序树【BST】——创建、查找、删除、输出
正畸注意事项(持续更新中)
P2141 [noip2014 popularization group] abacus mental arithmetic test
Benchmarking Detection Transfer Learning with Vision Transformers(2021-11)
HB 5469民用飞机机舱内部非金属材料燃烧试验方法
P1308 [noip2011 popularity group] count the number of words
保证接口数据安全的10种方案
C method question 1