The XML display area after formatting or compression
1. CREATE database database-name
2. Delete database drop database dbname
3. Backing up sql server: Creating backup data device USE master EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat' -- Start BACKUP DATABASE pubs TO testBack
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
A: create table tab_new like tab_old B: create table tab_new as select col1,col2... A: create table tab_new like tab_old from tab_old definition only
5. drop table tabname from a new table
6. add a column. Alter table tabname add column col type Note: Columns cannot be deleted after being added. The data type cannot be changed after columns are added in DB2, the only thing that can be changed is to increase the length of the varchar type.
7. Alter table tabname add primary key(col) Alter table tabname drop primary key(col)
8. create [unique] index idxname on tabname(col... .). drop index: drop index idxname Note: The index cannot be changed. If you want to change it, you must delete it and rebuild it.
9. create a view: create view viewname as select statement Delete a view: drop view viewname
10, a few simple basic sql statement selection: select * from table1 where range insert: insert into table1(field1,field2) values(value1,value2) Delete: delete from table1 where Range update: update table1 set field1=value1 where Range search: select * from table1 where field1 like '%value1%' --like syntax is very subtle, check the data! select * from table1 order by field1,field2 [desc] Total: select count as totalcount from table1 Sum: select * from table1 order by field1,field2 [desc] select sum(field1) as sumvalue from table1 Average: select avg(field1) as avgvalue from table1 Maximum: select max(field1) as maxvalue from table1: select min(field1) as minvalue from table1
Script home tool class small program online! Wechat applet search script home toolbox or scan the following applet code directly open applet!
Small program toolbox is still improving, welcome to put forward valuable comments!
In order to repay the attention of the majority of users to Script home, Script home carries out red envelopes, books and gifts from time to time
Follow the official wechat public platform to participate in the event!
Finally, thank you for your support of Script House Online tools!