当前位置:网站首页>Basic database syntax learning
Basic database syntax learning
2022-06-24 21:09:00 【GS_ Qiang】
One . New database
1. Graphical interface manual creation
Right click database – New database
2. Use code to create 
3. There is also a syntax for creating a database , Specify database file parameters and log file parameters , The grammar is as follows :create database Database name on [primary] ( < Data file parameters > [,…n] [< Filegroup parameters >] ) [log on] ( < Log file parameters > [,…n] )
Two . new table
1. Graphical interface manual creation
Right click table – new table
2. Use code to create 
3. Methods for inserting data into tables :
(1) Insert a piece of data (4 Methods ):
(2) Insert multiple data :
(3) Insert a new column name :
(4) Copy table to new table 
matters needing attention
(1): Insert one row at a time , It is impossible to insert only half a row or a few columns of data , therefore , Whether the inserted data is valid will be checked according to the integrity requirements of the whole row ;
(2): The data type of each data value 、 The precision and scale must match the corresponding column ;
(3): Cannot specify value for identity column , Because its number increases automatically ;
(4): If a column is specified when designing the table, it is not allowed to be empty , Data must be inserted ;
(5): Inserted data item , It is required to meet the requirements of inspection constraints
(6): Columns with default values , have access to default( default ) Keyword instead of the inserted value
4. Delete operation :
Be careful :
The operation of deleting the whole table is compared with that of emptying the whole table
Delete is to delete all , Including table structure
Emptying just empties the data in the table , But the table structure is still , Empty faster
5. Delete database :
6. modify

7. Inquire about 
3、 ... and . data type
1. Numeric type
bight -263~262-1
int -231~231-1
smallint -215~215-1
tinyint 0~255
float -1.79E+308-2.23E-308 as well as 2.23E-3081.79E+308
2. Time type
time 12:35:29.123456
date 2007-05-08
smalldatetime 2007-05-08 12:35:00
datetime 2007-05-08 12:35:00.123
datetime2 2007-05-08 12:35:00.1234567
3. String type
char[(n)] Fixed length .n Used to define the string length , And it must be 1~8000 Between the value of the
varchar [(n|max)] Variable length .n Used to define the string length , And it can be 1~8000 Between the value of the
nchar[(n)] Fixed length Unicode character string 1 data .n Used to define the string length , And it must be 1~4000 Between the value of the
nvarchar[(n)] Variable length Unicode character string 1 data .n Used to define the string length , And it can be 1~4000 Between the value of the
notes : In general use varchar and nvarchar, You can save memory

边栏推荐
猜你喜欢

Postman assertion

After a few years in the testing industry, do you still know a little?

Static routing job

The Google File System (GFS) learning notes

Enjoy yuan mode -- a large number of flying dragons

Pytest testing framework
![[普通物理] 光栅衍射](/img/f3/965ff7cd3bb76b4f71b69b9d12ece3.png)
[普通物理] 光栅衍射

JMeter basic learning records

Bean lifecycle flowchart

Web automation: summary of special scenario processing methods
随机推荐
Nifi fast authentication configuration
Difference between map and object
Microsoft Certification (dynamic 365) test
Image panr
CVPR 2022 remembers Sun Jian! Tongji and Ali won the best student thesis award, and hekaiming was shortlisted
伯克利、MIT、剑桥、DeepMind等业内大佬线上讲座:迈向安全可靠可控的AI
Does the developer want to change to software testing?
全上链哈希游戏dapp系统定制(方案设计)
Visitor model -- generation gap between young and middle-aged people
Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!
Open function
浅谈MySql update会锁定哪些范围的数据
Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI
Enjoy yuan mode -- a large number of flying dragons
C語言實現掃雷(簡易版)
The JS method parameter passed a number beginning with 0. A magical problem occurred and bothered me for a long time
网络安全审查办公室对知网启动网络安全审查
Common self realization functions in C language development
Responsibility chain mode -- through interview
When querying the database with Gorm, reflect: reflect flag. mustBeAssignable using unaddressable value