sql--

Source: Internet
Author: User

Blinkist app

SQL statements are case-insensitive, and most programmers prefer to use uppercase for SQL keywords, while for column names and indicating lowercase, easy to read and debug

Dividing SQL statements into multiple lines is easier to read and debug

Use less *, retrieving unnecessary columns can be a waste of performance


Don't spend time on things that you can spend money on.

specifically to differentiate the encoding:
ASCII code: An English letter equals one byte;
UTF-8 encoding: An English letter equals one byte;
Unicode encoding: An English letter equals two bytes.

Retrieval

SELECT ID as userId, name as username from users;

Insert in 3

INSERT into Table VALUES (NULL, ')

INSERT into Table VALUES (DEFAULT, ')

INSERT SET can use subqueries

INSERT SELECT to write the results of a lookup to a data table

In Update 2

Single table updates update users SET age = Age + ten WHERE id% 2 = 0;

Multiple table Updates

Delete in 2

Single-table Delete delete from

Multiple table deletions

Retrieval

SELECT ID as userId, name as username from users;

Group by groups The results of the query ASC default ascending DESC Descending, can be on a field, or ordinal, ordinal is the column field that appears after the first select

aggregate function, AVG MAX MIN because only one result will be returned at the end

MD5 (' 5 ')

SELECT Prod_name Prod_price
From Products

The above print out of the special magic, Prod_price as Prod_name alias. Print out the contents of the prod_name, a few commas. As can be used, or can not be used

sql--

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.