Linux operations engineer face test Nineth set

Source: Internet
Author: User

This time all is MySQL's question, very foundation, enjoy it~

1. Select Id,name from Test1; and select id name from Test1; What is the difference between these two statements?

The first statement appears with two columns, the second has only one column, the contents of the column are the contents of the ID, but the name of the column is name, which means that the second sentence is actually "select ID as name from Test1".


2. What commands are required if you want to migrate username that meet age greater than or equal to 30 in the Test1 table to the username column in the Test2 table?


3. List the id,name,age that satisfies the price in a table is greater than the average price of all goods in a table.

Select Id,name,age from a WHERE > (SELECT AVG. From a)

"Comments" can actually be calculated first AVG (price), and then directly greater than that value is good, but to note that select, the result of a select is a number.

If you need to round up the average and keep two digits after the decimal point, then Round (AVG., 2)


4, Test1 table has a name called "Brand" column, now need to do a test2, specifically put these "brand", and realize the two tables of the multi-table connection.

This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1745859

Linux operations engineer face test Nineth set

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.