SQL
[Basic Grammar] SQL SELECT Statement
grace21110
2023. 10. 12. 20:44
반응형
SELECT statement is used to select data from a database.
Example
SELECT CustomerName, City FROM Customers;
- Syntax
SELECT column1, column2, ...
FROM table_name;
- Select all columns
Example
SELECT * FROM Customers;
Let's solve the following exercises together.
Exercises
- Write an SQL query to retrieve all the records from a table named "Employees."
- SELECT * FROM Employees;
- Create an SQL query to fetch the titles and publication dates of all books from a table named "Books."
- SELECT title, publication_date FROM Books;
- Write an SQL query to retrieve the product IDs and names of all products from a table named "Products."
- SELECT product_id, product_name FROM Products;