zhiqingstudy

Be a young person with knowledge and content

1. As keyword usage

Syntax format: SELECT field 1 as alias 1, field 2 as alias 2 FROM table name;

Example:

SELECT name as name, age as age FROM member;

Abbreviation syntax: SELECT name name, age age FROM member;

2. How to use the distinct keyword

Usage scenario of the distinct keyword: there is a lot of duplicate data in a field, such as the gender data in the data table. There are only two genders, and there will be a lot of duplicate data. Using the distinct keyword can remove the duplicate data.

Syntax format: SELECT DISTINCT (field name) FROM table name;

Example:

SELECT DISTINCT(gender) FROM member;

Extension: How to query duplicate data of multiple fields? For example, there are many male and female members of the same age among the members. Find out the information of the members whose age has been eliminated?

Syntax: SELECT DISTINCT (age), gender, name FROM member;

comment
head sculpture
Code:
Related

Why you shouldn't stay at a job for more than 2 years?

3 harsh facts long-distance relationships

how to keep your girlfriend interested in a long-distance relationship




Unless otherwise specified, all content on this website is original. If the reprinted content infringes on your rights, please contact the administrator to delete it
Contact Email:2380712278@qq.com

Filing number:皖ICP备19012824号