SQL databases T-SQL statement query

Source: Internet
Author: User

SQL databases T-SQL statement query

Data files for attached databases

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M01/96/06/wKiom1kcDfOB6lJHAAtJeP4PO9c190.jpg "style=" float : none; "title=" 1.jpg "alt=" Wkiom1kcdfob6ljhaatjep4po9c190.jpg "/>

The category in the query table is the fruit of the factory date after 201-04-01

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/96/06/wKioL1kcDfPRsARaAAA-AqGZuw8071.png "style=" float : none; "title=" 2.png "alt=" Wkiol1kcdfprsaraaaa-aqgzuw8071.png "/>

Query the total cost of all kinds

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/96/06/wKioL1kcDfPSAGgeAAApWqNeaNg208.png "style=" float : none; "title=" 3.png "alt=" Wkiol1kcdfpsaggeaaapwqneang208.png "/>

Query the cost of fruit in a table in reverse order

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M02/96/06/wKiom1kcDfrwfrwOAA0HgA89MVE784.jpg "style=" float : none; "title=" 4.jpg "alt=" Wkiom1kcdfrwfrwoaa0hga89mve784.jpg "/>

The query type is vegetable and the price is between 1-5

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M01/96/06/wKiom1kcDgDR9UbfAAz7uJVq95U986.jpg "style=" float : none; "title=" 5.jpg "alt=" Wkiom1kcdgdr9ubfaaz7ujvq95u986.jpg "/>

Save the name, type, and factory date data from the Product table in another table named Product_new, and view

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M02/96/06/wKioL1kcDgfw85p9AA4kXHkDE2A461.jpg "style=" float : none; "title=" 6.jpg "alt=" Wkiol1kcdgfw85p9aa4kxhkde2a461.jpg "/>

Query the Products table and Sales table for product names, types, costs, sales locations, and sales prices.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/96/06/wKiom1kcDgixnzZZAABHmYNd_rE481.png "style=" float : none; "title=" 7.png "alt=" Wkiom1kcdgixnzzzaabhmynd_re481.png "/>

in the Products table and Sales table Query the product name, type, cost and sales price of Hainan.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/96/06/wKioL1kcDgiTwYhxAABRIBMddCI993.png "style=" float : none; "title=" 8.png "alt=" Wkiol1kcdgitwyhxaabribmddci993.png "/>

Query Age is more than, less than , and the position is employee ?

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/96/06/wKioL1kcDgjRe_bMAAAs9MW26Zc669.png "style=" float : none; "title=" 9.png "alt=" Wkiol1kcdgjre_bmaaas9mw26zc669.png "/>

find the average age of employees ?

650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M02/96/06/wKiom1kcDg_gE8GLAAzuxPvuuVY834.jpg "style=" float : none; "title=" 10.jpg "alt=" Wkiom1kcdg_ge8glaazuxpvuuvy834.jpg "/>

Check the average age of various positions , and sorted in descending order of average age for each position ?

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/96/06/wKioL1kcDhGSZ9o7AAA2ugRFl2M447.png "style=" float : none; "title=" 11.png "alt=" Wkiol1kcdhgsz9o7aaa2ugrfl2m447.png "/>

query who is the oldest and youngest person ?

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/96/06/wKiom1kcDhHTY-o_AAAmcYaYCDE072.png "style=" float : none; "title=" 12.png "alt=" Wkiom1kcdhhty-o_aaamcyaycde072.png "/>

find out how many people are in each position ? and sorted by the number of people in each position in ascending order ?

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/96/06/wKiom1kcDhGCn07yAAA2B028hnU495.png "style=" float : none; "title=" 13.png "alt=" Wkiom1kcdhgcn07yaaa2b028hnu495.png "/>

query age greater than or equal to - years and less than - who are the years old? ?

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/96/06/wKioL1kcDhLRyFIxAAAxNYPqkhc829.png "style=" float : none; "title=" 14.png "alt=" Wkiol1kcdhlryfixaaaxnypqkhc829.png "/>



This article is from "Love Linux" blog, reproduced please contact the author!

SQL databases T-SQL statement query

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.