Basic SQL Tutorial

Source: Internet
Author: User
Tags sql tutorial

What is Http://www.w3school.com.cn/sql/sql_intro.asp1.SQL referring to?

Structured Query Language

2. Which SQL statement is used to extract data from the database?

SELECT

3. Which SQL statement is used to update data in the database?

UPDATE

4. Which SQL statement is used to delete data from the database?

DELETE

5. Which SQL statement is used to insert new data into the database?

INSERT into

6. With SQL, how do you choose the "FirstName" column from the "Persons" table?

SELECT FirstName from Persons

7. With SQL, how do you pick all the columns from the "Persons" table?

SELECT * from Persons

8. With SQL, how do you choose All records from the "Persons" table with the value of "FirstName" column equal to "Peter"?

SELECT * from Persons WHERE firstname= ' Peter '

9. With SQL, how do you choose All records from the "Persons" table that have the value of the "FirstName" column beginning with "a"?

SELECT * from Persons WHERE FirstName like ' a% '

10. Determine if the following statements are correct: When a condition listed is true, the OR operator displays a record. When all of the listed conditions are true, the AND operator displays records.

That's right

11. With SQL, how do you select FirstName equals Thomas in table Persons and LastName equals all records of Carter?

SELECT * from Persons WHERE firstname= ' Thomas ' and lastname= ' Carter '

12. With SQL, how do you select All records in the Persons table that are LastName between Adams and Carter in alphabetical order?

SELECT * from Persons WHERE LastName between ' Adams ' and ' Carter '

13. Which SQL statement can return a unique different value?

SELECT DISTINCT

14. Which SQL keyword is used to sort the result set?

ORDER by

15. With SQL, how do you return all records from the "Persons" table in descending order of the "FirstName" column?

SELECT * from Persons ORDER by FirstName DESC

16. With SQL, how do you insert a new record into the "Persons" table?

INSERT into Persons VALUES (' Jimmy ', ' Jackson ')

17. With SQL, how do you insert "Wilson" into the "LastName" column in the "Persons" table? INSERT into Persons (LastName) VALUES (' Wilson ') 18. How do you change "Gates" in the "LastName" column in the "Persons" table to "Wilson"?

UPDATE Persons SET lastname= ' Wilson ' WHERE lastname= ' Gates '

19. Through SQL, how do you delete "FirstName" equals "Fred" in the "Persons" table?

DELETE from Persons WHERE FirstName = ' Fred '

20. Through SQL, how do you return the number of records in the "Persons" table?

SELECT COUNT (*) from Persons

Basic SQL Tutorial

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.