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

边栏推荐
- Freshman girls' nonsense programming is popular! Those who understand programming are tied with Q after reading
- Memo mode - game archiving
- An example illustrates restful API
- After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
- Open programmable infrastructure (OPI) project, redefining dpu/ipu
- C語言實現掃雷(簡易版)
- Common member methods of the calendar class
- Appium desktop introduction
- Nifi fast authentication configuration
- VMware virtual machine setting static IP
猜你喜欢

Sleep revolution - find the right length of rest

The difference between RPC and restful

The JS method parameter passed a number beginning with 0. A magical problem occurred and bothered me for a long time

Grating diffraction

Sequence stack version 1.0

Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable

Web automation: summary of special scenario processing methods

Interpreter mode -- formulas for dating

Intermediary model -- collaboration among departments

Handling of garbled JMeter response data - three solutions
随机推荐
Image panr
Learn together and make progress together. Welcome to exchange
Reflect package
Enjoy yuan mode -- a large number of flying dragons
[performance tuning basics] performance tuning strategy
JMeter basic learning records
Markdown use
Appium desktop introduction
传统的IO存在什么问题?为什么引入零拷贝的?
Pytest testing framework
Leetcode (135) - distribute candy
Leetcode (146) - LRU cache
Format method and parse method of dateformat class
Typescript syntax
Limit summary (under update)
微信小程序自定义tabBar
How to apply agile development ideas to other work
[multi thread performance tuning] multi thread lock optimization (Part 1): optimization method of synchronized synchronization lock
Physical layer introduction
JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps