Data Science Explorer

[Basic Grammar] SQL SELECT Statement 본문

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

 

  1. Write an SQL query to retrieve all the records from a table named "Employees."
  2. SELECT * FROM Employees;
  3. Create an SQL query to fetch the titles and publication dates of all books from a table named "Books."
  4. SELECT title, publication_date FROM Books;
  5. Write an SQL query to retrieve the product IDs and names of all products from a table named "Products."
  6. SELECT product_id, product_name FROM Products;

 

'SQL' 카테고리의 다른 글

[Basic Grammar] SQL ORDER BY  (0) 2023.10.12
[Basic Grammar] SQL WHERE Clause  (0) 2023.10.12
SQL Code Analysis  (0) 2023.10.11
SQL Code Analysis  (0) 2023.10.10
SQL Code Analysis  (0) 2023.10.10