Single‑Table SELECT Statements
Below are the SQL statements used to retrieve data from individual tables during the activity:
- SELECT * FROM CUSTOMERS;
- SELECT CustomerName, City FROM CUSTOMERS;
- SELECT * FROM ORDERS;
- SELECT OrderID, OrderDate FROM ORDERS;
- SELECT * FROM PRODUCTS;
- SELECT ProductName, Price FROM PRODUCTS;
INSERT, UPDATE, and DELETE Statements
These statements were used to modify data in the database during the activity:
- INSERT INTO CUSTOMERS (CustomerName, City) VALUES ('John Smith', 'Chicago');
- INSERT INTO PRODUCTS (ProductName, Price) VALUES ('Laptop', 899.99);
- UPDATE CUSTOMERS SET City = 'New York' WHERE CustomerID = 3;
- UPDATE PRODUCTS SET Price = 499.99 WHERE ProductID = 10;
- DELETE FROM ORDERS WHERE OrderID = 15;
- DELETE FROM CUSTOMERS WHERE CustomerID = 7;
This is what I learned
I learned the basics of using SELECT statements while also learning about INSERT, UPDATE, and DELETE statements. To start, I learned INSERT statements are used to add data to an existing table. UPDATE changes existing data, and DELETE will delete data permanently. SELECT statements will be used to pull any existing data up and can be used in combination with other keywords to narrow down the search.