For example, the following query selects only the values in the employeeID and name fields of the employee table:
select name, employeeID from employee;
If you run this query on the employee database, you should get a result that looks similar to the following:
+---------------+-------------+
| name | employeeID |
+---------------+-------------+
| Ajay Patel | 6651 |
| Nora Edwards | 7513 |
| Candy Burnett | 9006 |
| Ben Smith | 9842 |
+-------------+---------------+
4 rows in set (0.00 sec)
You can see that only the two columns we specified have been returned. Note that the columns are displayed in the order in which we requested the columns in the query, rather than the order in which they appear in the database schema.
No comments:
Post a Comment