SQL Server Learning Notes

Source: Internet
Author: User

Select * fromStudent--Querying the databaseCreate Databases20150417--New DatabaseDrop Database [20150325] --to delete a database number starts with [] surround Uses20150417--Working with DatabasesGo --connector is not written or can beCreate TableStudent--Create a table(Codeint  not NULL,--columnNamevarchar( -) not NULL,--columnSexint,--columnDegreedecimal( -,2) not NULL--column) GoInsert  intoStudentValues(1,'Zhang San',0, About);--Insert data corresponds to the above table four column insert value corresponding data typeInsert  intoStudentValues(3,'John Doe',1, the);Insert  intoStudent (Code,name,degree)Values(4,'Harry', the);--Specify columns to addGoUpdateStudentSetSex=0UpdateStudentSetSex=0 whereCode=3 --Modify a column's value to select a row in whereUpdateStudentSetName='Tianqi' whereCode=4 --wheres filtering modifies a control conditionGoSelect * fromStudentSelect * fromTongxunluwhereName=' Zhang San'--EnquiryGoUpdateStudentSetName='spacecraft', code=5, Degree= About whereName='Tianqi'Delete  fromStudent--Delete all dataDelete  fromStudentwhereCode=3 --Delete a row of code=3Drop TableStudent--Delete a table--primary key plays a unique role in improving query efficiencyCreate TableTeacher (TNOint Primary Key Identity(1,1),--self-growing primary keyTnamevarchar( -))--Enquiry--select *from table where column name and column name


Create TableXinxibiao (Noint Primary Key Identity(1,1),--self-increment primary key namevarchar( -) not NULL, Sexvarchar( -) not NULL, Ageint  not NULL, Highint  not NULL, TZdecimal( -,2) not NULL, Sfzhvarchar(Max) not NULL, Zhuzhivarchar(Max) not NULL)Insert  intoXinxibiaoValues('Hong Yi','male', -, the, -,'370012598632152233','Hong Kong')Select * fromXinxibiaoSelect * fromXinxibiaowhereHigh>163  andSex='male'UpdateXinxibiaoSetName='Zhang Ye' whereName='OSPU'--between and between what and whatSelect * fromXinxibiaowhereHighbetween 165  and 175Select * fromXinxibiaowhereName like 'Li%'--the name of Li in the query table--% is a wildcard can replace any character and data like the meaning of

SQL Server Learning notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.