-
select a name field, 2 field names, field names 3, ... from the table name:
prompt:
1. any sql statement to a ":" at the end.
-
sql statement is not case sensitive.
-
-
Query annual salary of employees? (Field can participate in math.)
-
select ename,sal *12 from emp:
enmae: name
sal: monthly salary
-
-
Query results are listed rename?
-
select ename,sal *12 as yearsal from emp:
yearsal: Rename salary
-
-
There are Chinese alias?
-
select ename, sal * 12 as annual salary from emp: // Error
-
select ename, sal * 12 as 'salary' from emp: // correct
note:
Sql statement using standard single quotes. Although mysql support double quotes, try not to use.
as keywords can be omitted
-
-
A query field
-
ename from emp the SELECT: \ query the employee's name
-
-
Query two fields
-
select empno, ename from emp: \ query the number of employees Name
Query multiple fields, select the text can be separated by a comma, the last field, that is, from the front of the field can not use a comma.
-
-
All Fields query
-
select * from emp: // actual development * not recommended, under development efficiency.
-
2, simple query: (DQL)
Guess you like
Origin www.cnblogs.com/wn-888/p/11611214.html
Recommended
Ranking