Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Principle and Design of Database system-- projection Operation and selection Operation

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Books: principles and Design of Database system (3rd Edition)-- edited by Liao Guoqiong et al.

Database version: SQL Server 2005

/ *

Select courseNO as course number, lower (coursename) course name, courseHour/16 as weekly class hours

From course

, /

/ *-the use of "% arbitrary characters", "_" wildcards

Select *

From class

Where className like'% accountant%'

Select studentNo,studentName

From Student

Where studentName like 'King _ _'

Select studentNo,studentName

From Student

Where studentName not like'% Fu%'

Select studentNo,studentName,nation

From Student

Where nation not like 'Mongolian'

Select studentNo,studentName,nation

From Student

Where nation like 'Mongolian'

, /

-- use of wildcards

/ *

Select className

From class

Where className like'% 'ESCAPE'\'

Union

Select className

From class

Where className like'\ _%'--No

Union

Select className

From class

Where className like'_% 'ESCAPE'\'--No

, /

For the use of escape characters, the following two methods are similar

/ *

Select className

From class

Where className like'# _% 'escape'

Select className

From class

Where className like'% 'ESCAPE'\'

, /

/ *-learn the logical operator or and

Select studentNo,courseNO,score

From score

Where courseNo='001' or courseNo='005' or courseNo='003'

Select studentNo,courseNO,score

From score

Where courseNo='001' and courseNo='003'

Select studentNo,courseNO,score

From score

Where courseNo in ('001', '005', '003')

, /

/ *

Select studentNO as student number, studentName as name, year (birthday) as year of birth

From Student

Where year (birthday) = 1998 and nation=' Han'

, /

/ *-if you are not born in Nanchang or Shanghai, choose one of the two implementation methods.

Select studentNO as student number, studentName as name, native

From Student

Where native not in ('Nanchang', 'Shanghai')

Select studentNO as student number, studentName as name, native

From Student

Where, Nanchang, and, Shanghai.

, /

/ * score in the 80m / m / m / 90 range

Select studentNo,courseNO,score

From score

Where score > = 80 and score

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report