SQL Server database basic INSERT, delete command

Source: Internet
Author: User

First, the experimental material:

Additional Student Information Form (student)

Second, the experimental requirements:

1. Query the information of all students in the student table

SELECT * FROM Student

2, Query student table "name" "Class" and "Score" column content

Select name, class, score from student

3. Check the names of students in Class 7 in the student table

select name from student WHERE class = ' 7 '

4, Query the student table in the score of 90-100 students all information

SELECT * FROM Student where scores between and

5. Check the information of students who have scored less than 90 points or above 95 points in the student table

SELECT * FROM student where score <90 or score >95

6, query the student table score is 89 points, 90 points of the students all information

SELECT * FROM student where score =89 or score =90

7. Check all information of students surnamed Liu in student table

SELECT * FROM student where name like ' Liu% '

8, inquires the student table in 1 class's name Zhang Hong's student information

SELECT * FROM student where class = ' 1 ' and name = ' Zhang Hong '

9, Query the student table in the note is not empty students all information

SELECT * FROM student where memo is not NULL

10, query the student table in the first 3 rows of data

Select Top 3 * from student

11, Query student table "name" and "Social Security Number" two columns of data, query results "name" column name appears as "name", "id" column name is displayed as "Idcard"

Select name as name, social Security number as Idcard from student

12. Query the total scores of all students in the student table, the column name is displayed as "overall",

Select SUM (Score) as total from student

13. Query All student information in the student table and display the results from high to low according to results

SELECT * FROM student ORDER BY score Desc

14. Check the average scores of all students in the student table

Select AVG (score) as average score from student

15. Check the highest and lowest scores of all students in the student table

Select Max (score) as highest score, Min (score) as Min. from student

16. Query all rows in the student table

Select COUNT (*) Total rows from student

17. Check the total of each class in the student table

Student class, sum (Result) as total score from student group by class

18, query the student table of the total score greater than 181 points of the class

Student in the class, sum (Score) as the total from the student group by the class having a sum (score) >181

19, the student table in 1 classes of student information stored in the table student_1

Student * to AAA from Studentwhere class = ' 1

SQL Server database basic INSERT, delete command

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.