SQL Programming Resources: post #2709 โ€” TG.ME

๐Ÿง  Common Beginner Mistakes

โŒ Mistake 1: Forgetting FROM

Wrong: SELECT customer_name;

Correct: SELECT customer_name FROM customers;

โŒ Mistake 2: Using commas incorrectly

Wrong: SELECT customer_id customer_name city

Correct: Use commas

โŒ Mistake 3: Using quotes around column names unnecessarily

SELECT 'customer_name' treats it as text, not column.

โŒ Mistake 4: Confusing *

SELECT * means return all columns, not all rows.

๐ŸŽฏ Practice Questions

Q1. Display all columns from employees

Q2. Display employee_name, salary, department_id

Q3. Display unique cities from customers

Q4. Display product_name, price and 15% discounted price

Q5. Display product_name, selling_price, cost_price and profit

Q6. Display customer names with alias Customer

Q7. Display employee name and salary increased by 10%

โœ… Answers

-- A1
SELECT * FROM employees;

-- A2
SELECT employee_name, salary, department_id FROM employees;

-- A3
SELECT DISTINCT city FROM customers;

-- A4
SELECT product_name, price, price * 0.85 AS discounted_price FROM products;

-- A5
SELECT product_name, selling_price, cost_price, selling_price - cost_price AS profit FROM products;

-- A6
SELECT customer_name AS Customer FROM customers;

-- A7
SELECT employee_name, salary, salary * 1.10 AS increased_salary FROM employees;


๐Ÿ’ผ Interview Questions

1. What does SELECT do? โ†’ Retrieves data from columns.

2. What does SELECT * mean? โ†’ Retrieves all columns.

3. What is DISTINCT? โ†’ Removes duplicate combinations.

4. What is an alias? โ†’ Temporary name for clarity.

5. Can SQL perform calculations? โ†’ Yes, arithmetic expressions directly in queries.

Double Tap โค๏ธ For Part-3
โค8
August 28, 2026 1.2K 7