SQL Advanced Operations

Source: Internet
Author: User

Also used for recording for future contact! It basically contains the advanced usage of general SQL!

drop table if exists stu;create table stu (name varchar (), age int,stuid int not null PRIMARY key Auto_increment,idnum int , sex varchar (+), check (Sex in (' Male ', ' female ')) Charset=utf8;insert into Stu (name,age,idnum,sex) VALUES (' Damon ', 789,4678945 , ' Male '), insert into Stu (Name,age,idnum,sex) VALUES (' Coco ', 13,345, ' female '), insert into Stu (Name,age,idnum,sex) VALUES (' Kitty ', 13, 46, ' female '), insert into Stu (Name,age,idnum,sex) VALUES (' Alice ', 14,123, ' female '); SELECT * FROM Stu;select * from Stu limit 0,2;select * from Stu where name like '%ce '; select * from Stu where name REGEXP  "A[sfdl][^ads]"; select * from Stu where name in (' Damon ', ' Alice '); select * from Stu where name between ' Coco ' and ' Kitty '; SELECT * from Stu where name isn't between ' Coco ' and ' Kitty '; select name as stuname,stuid as ID from Stu;drop view if Exis TS young_stu;create View Young_stu asselect name,age from Stu where age between ten and 20;select * from Young_stu where AG E is not null;

A chapter is later recorded that specifically uses SQL functions.

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.