Column Aliasing & Expressions: Next
Module: SQL Fundamentals
WHERE Clause & Filtering
SELECT & Data Retrieval
CASE Statements & Conditional Logic
String Functions & Operations
Arithmetic & Numeric Functions
Write a query returning full_name, annual_salary, and monthly_salary for all employees — ORDER BY annual_salary DESC
Fix this query: SELECT price * 1.2 AS price_with_tax FROM products WHERE price_with_tax > 100
Build a product report with: subtotal, discount_amount (10%), net_amount, and tax_amount (8%) — all using ROUND()
Write a SARGable rewrite for: WHERE MONTH(order_date) = 3 AND YEAR(order_date) = 2024
Create a NULL-safe full_name expression that works on PostgreSQL, MySQL, and SQL Server
Write a JOIN query using table aliases for employees, departments, and locations — no ambiguous column names
Why can you use a column alias in ORDER BY but not in WHERE?
What is a non-SARGable predicate? Give an example and fix it.
How does NULL behave in || concatenation vs CONCAT()?
Can you use a SELECT alias in GROUP BY? Does it depend on the database?
What is operator precedence in SQL arithmetic? Give a formula that would be wrong without parentheses.
PostgreSQL docs: Value Expressions and Operator Precedence
SQL Server docs: Column Aliases (Transact-SQL)
MySQL docs: CONCAT() and String Functions
Use The Index, Luke: Sargable WHERE Clauses