Sqlsever base except difference sets an element that does not contain the latter result in the previous result

Source: Internet
Author: User

Town Field Poem:
——— Dream who feel, the water month Build blog. Baiqian tribulation, only know the vicissitudes of the world.
——— today holds the Buddhist language, the technology is boundless willing to learn. Willing to do what you learn, cast a conscience blog.
——————————————————————————————————————————

1 Base Code

1  UseMaster2 Drop DatabaseHelloWorld3 4 5 --Create a database6 Create DatabaseHelloWorld7 8 9 Ten --use helloworld1 this database One  UseHelloWorld A  - --Create a table Fojiateacher - Create TableFojiateacher the ( -Idint Primary Key Identity(1,1),    -Namenvarchar(Ten), -Classnchar(2), +Scorefloat - ) +  A --Create a table Fojiateacher at Create TableDaojiateacher - ( -Idint Primary Key Identity(1,1),    -Namenvarchar(Ten), -Classnchar(2), -Scorefloat in ) -  to  + Select *  fromFojiateacher - Select *  fromDaojiateacher the  * --insert these lines of content into this teacher, which I insert once, simply modify, and insert again $ Insert  intoFojiateacherPanax Notoginseng        Values('burning lamp Ancient Buddha','Buddhist', -), -('Buddha Buddha','Buddhist', -), the('Maitreya Buddha','Buddhist', -), +('Buddha Buddha','Buddhist', -), A('Buddhist Bodhisattva','Buddhist', -), the('The Buddha','Buddhist',101)--For convenience, add 1 points to the Bodhisattva +  - Insert  intoDaojiateacher $        Values('nu wa Niang','Taoism', -), $('Yangmn greedy wolf too star June','Taoism',101), -('Yin Jing giant door Yuan Xing June','Taoism',101), -('Live Lu, the true star','Taoism',101), the('Xuan Ming Wen qu new star June','Taoism',101)

2 Code table1

1 Select *  from

3 table1

4 Code Table2

1 Select *  from Fojiateacher

5 table2

6 Key Code1

1 Select *  from where score=

7 Key Code 1 show

8 Key Code 2

1 Select *  from where score=

9 Show Key Code 2

Ten Key Code 3

1 -- Buddha Road A home, Socre for 100 has, show its ID 2 -- The ID number in the except Taoist, which does not appear in the final result 3 Select  from where score=4except5Select  fromwhere score=

Show Key Code 3

Key Code 4

1 -- The ID number in the Buddhist does not appear in the final result 2 Select  from where score=3except4selectfrom  where score=

Show Key Code 4

——————————————————————————————————————————
The essence of the blog, in the technical part, more in the town yard a poem.
Sqlsever is a good language, worth studying hard. Familiar with the database of additions and deletions, write procedures necessary.
If the content of the post can be improved, or even the wrong place, please leave a comment, I will try to correct, strive to cast a conscience blog.
Note: This article is only as a scientific research study, if I inadvertently violated your rights and interests, please be sure to timely inform, I will make corrections.

Sqlsever base except difference sets an element that does not contain the latter result in the previous result

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.