SQL Server review notes 03

Source: Internet
Author: User
-- 5. use of top [precent] -- insert into book1 values ('20170101', '20160301', 'SQL database', 35, 'Sun Yat-sen ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20170101', '20170101', 'java', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'html', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'css ', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20160301', '20160301', 'jsp ', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('123456', '123456', 'javascript ', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'php', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('02 ', '000000', 'asp', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20160301', '20160301', 'struts ', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'hibernate ', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'spring', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'xml', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20170901', '32', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('y101172 ', '123',' SQL database', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- insert into book1 values into the complete table structure ('20140901', '20160901', 'SQL database', 35, 'Sun Yat-sen University', '03-13-2008 ') -- insert into book1 values into the complete table structure ('r101172 ', '123',' SQL database', 35, 'Sun Yat-sen University ', '03-13-2008 ') -- Insert the complete table structure -- select -- Query all select * From book1 -- query the first five rows of Data select top 5 * From book1 -- query the first 5% rows of data, a total of 27 rows, in this case, the first row is located. The actual result is to find two rows of select top 5 percent * From book1 -- display the column title in the query result. Three methods are available: select number as 'book number ', title as 'book name' from book1 -- display the string select title in the query results, 'book pricing: ', pricing from book1order by title desc -- select title in descending order, 'book pricing: ', pricing from book1order by title ASC -- Ascending -- sort by book name in ascending order. If the book name is the same, sort by number in ascending order select * From book1order by title DESC, no. ASC--IN and not inselect * From book1where No. In ('20140901', '20160901', '20160901 ') select * From book1where No. = '20160301' or no. = '20160301' or no. = '20160301' select * From book1where no. Not in ('20160301', '20160301 ', '123') Select * From book1where No. <> '123' and No. <> '123' and No. <> '123'/* 6. use of like, % indicates one or more characters; _ indicates one character; [] matches with brackets, [^] does not match the content of brackets; to display the wildcard itself, [] enclose it in parentheses */-- query the name of the book. The second character is select * From book1where the name of the book like '_ S %' -- query the name of the first character instead of qselect * From book1where title not like '_ q %' select * From book1where title like '_ [^ q] %' -- Is nullselect * From book1where Publishing House is null -- between and not betweenselect * From book1where Pricing not between 0 and 66 -- computeselect * From book1where press = 'Sun Yat-sen 'compute AVG (pricing ), sum (pricing)

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.