DB Command
DB Command
command
SELECT studentID, FirstName, LastName, FirstName + ' ' + LastName AS FullName
FROM student;
+-----------+-------------------+------------+------------------------+
| studentID | FirstName | LastName | FullName |
+-----------+-------------------+------------+------------------------+
| 1 | Monique | Davis | Monique Davis |
| 2 | Teri | Gutierrez | Teri Gutierrez |
| 3 | Spencer | Pautier | Spencer Pautier |
| 4 | Louis | Ramsey | Louis Ramsey |
| 5 | Alvin | Greene | Alvin Greene |
| 6 | Sophie | Freeman | Sophie Freeman |
| 7 | Edgar Frank "Ted" | Codd | Edgar Frank "Ted" Codd |
| 8 | Donald D. | Chamberlin | Donald D. Chamberlin |
| 9 | Raymond F. | Boyce | Raymond F. Boyce |
+-----------+-------------------+------------+------------------------+
9 rows in set (0.00 sec)
CREATE TABLE
CREATE TABLE does just what it sounds like: it creates a table in the database. You
can specify the name of the table and the columns that should be in the table.
If you define a CHECK constraint on a single column it allows only certain values
for this column. If you define a CHECK constraint on a table it can limit the
values in certain columns based on values in other columns in the row.
The following SQL creates a CHECK constraint on the “Age” column when the “Persons”
table is created. The CHECK constraint ensures that you can not have any person
below 18 years.
As an example, first we will show you a SELECT statement and results without a
WHERE statement. Then we will add a WHERE statement that uses all five qualifiers
above.