Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views4 pages

SQL Commands and Explanations

Uploaded by

Marga Balajadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

SQL Commands and Explanations

Uploaded by

Marga Balajadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SQL Commands and Explanations

SHAYNE
1. SELECT * FROM cakes;

 This command retrieves all columns and all rows from the cakes table.
 It provides a complete listing of every available cake in the database.
 It is used when an overall view of the cakes data is required.

2. SELECT * FROM artists;

 This command returns every column and record in the artists table.
 It is used to review all information about available artists.
 It provides a quick snapshot of the artists registered in the system.

3. SELECT * FROM orders;

 This command fetches all columns and entries from the orders table.
 It gives an overview of every order placed in the database.
 It is used to review the status and details of all orders.

4. SELECT * FROM orders WHERE payment_method = 'G-Coin';

 This command selects all columns of orders where the payment method is G-Coin.
 It filters results to only include G-Coin payments.
 It is used for analyzing payment methods and transactions.

5. SELECT * FROM cakes WHERE layers = 'Choco Sponge';

 This command retrieves cakes that have 'Choco Sponge' as their layer.
 It allows the user to locate cakes with a specific characteristic.
 It is used for identifying products with certain specifications.
TIFFANY
6. SELECT * FROM customers WHERE address = 'Mars Colony 1';

 This command finds all customers located in 'Mars Colony 1'.


 It narrows down the results based on the address criteria.
 It is used to review customer data for a specific area.

7. SELECT DISTINCT artist_assigned FROM artists;

 This command returns unique values from the artist_assigned column.


 It removes any duplicate artist assignment entries.
 It is used to obtain a list of distinct artists available.

8. SELECT DISTINCT delivery_date FROM delivery;

 This command finds unique delivery dates from the delivery table.
 It removes duplicate instances of the same date.
 It is used to review available or used delivery dates.

9. SELECT * FROM cakes WHERE cake_design LIKE '%O%';

 This command searches for cakes where the design contains the character 'O'.
 It uses the LIKE operator for partial match searches.
 It is used to locate cakes with a specific pattern in the design name.

10. SELECT * FROM customers WHERE customer_name LIKE 'L%';

 This command finds customers whose names begin with the letter 'L'.
 It uses the LIKE operator for pattern-based filtering.
 It is used to review a specific segment of the customer list.
ZHAMIRA
11. SELECT * FROM cakes WHERE cake_design = 'Matcha Nebula' AND toppings =
'Sprinkles'

 This command retrieves cakes with the design 'Matcha Nebula' and the topping
'Sprinkles'.
 It applies multiple conditions using the AND operator.
 It is used for highly specific searches in the cakes table.

12. SELECT * FROM customers WHERE customer_name = 'Leia Starbake' OR


customer_name = 'Stella Crustfield'

 This command finds customers named 'Leia Starbake' or 'Stella Crustfield'.


 It uses the OR operator to match either of the names.
 It is used when checking information about specific customers.

13. SELECT * FROM delivery WHERE delivery_date BETWEEN '2025-06-25' AND


'2025-07-01'

 This command selects deliveries within a specific date range.


 It uses the BETWEEN operator for filtering results.
 It is used to review deliveries scheduled within a certain period.

14. SELECT delivery.delivery_id, delivery.customer_id, customers.customer_name FROM


delivery INNER JOIN customers ON delivery.customer_id = customers.customer_id;

 This command retrieves delivery and customer information together.


 It uses an INNER JOIN to match customers with their deliveries.
 It is used to display combined data for better delivery and customer tracking.

15. SELECT orders.order_id, orders.cake_id, cakes.cake_design FROM orders INNER


JOIN cakes ON orders.cake_id = cakes.cake_id;

 This command finds the order ID, associated cake ID, and its design.
 It links the orders table with the cakes table using an INNER JOIN.
 It is used for viewing order details alongside the related cake design.
MARGA
16. SELECT delivery.delivery_id, delivery.delivery_date, customers.customer_id FROM
delivery LEFT JOIN customers ON delivery.customer_id = customers.customer_id;

 This command retrieves all delivery records and associated customer details if available.
 It uses a LEFT JOIN to include deliveries regardless of matching customers.
 It is used when verifying deliveries and their associated customer data.

17. SELECT orders.order_id, orders.cake_id, cake_artists.artist_id FROM orders LEFT


JOIN cake_artists ON orders.cake_id = cake_artists.cake_id LEFT JOIN artists ON
cake_artists.artist_id = artists.artist_id;

 This command finds order details, associated cakes, and the artists responsible for them.
 It uses LEFT JOIN to link the orders, cake_artists, and artists tables.
 It is used to review relationships between orders, cakes, and artists.

18. INSERT INTO customers VALUES ('CN008', 'Celeste Moonwhip', 'Lunar Crater
Bay');

 This command adds a new customer record to the customers table.


 It provides a customer ID, name, and address for the new entry.
 It is used for registering new customers in the database.

19. DELETE FROM cakes WHERE cake_design = 'Galactic Chocolate'

 This command removes any cakes named 'Galactic Chocolate' from the database.
 It uses a DELETE statement combined with a WHERE clause.
 It is used to remove obsolete or unavailable products.

20. UPDATE cakes SET layers = 'Red Velvet' WHERE cake_id = 'C001'

 This command updates the layers column to 'Red Velvet' for the cake with ID C001.
 It uses an UPDATE statement combined with a WHERE clause for targeted changes.
 It is used for making corrections or updating details in existing records.

You might also like