SQL Query Essentials: From Basic Selection to Complex Joins
Selecitng Data
Basic SELECT Statements
SELECT *
FROM customers
WHERE customer_id = 1
ORDER BY first_name;
Selecting Specific Columns
SELECT
first_name,
last_name,
points,
points + 10,
points / 10 + 100,
(points + 10) * 100 AS discount_factor,
(points + 10) * 100 AS 'discount factor'
FROM customers;
Note: Use ...
Posted on Mon, 14 Sep 2026 16:04:42 +0000 by marque
Multi-Table Query Techniques in MySQL
Multi-Table Relationships
When designing relational schemas for applications, tables often relate due to business logic. Common relationship types include:
One-to-Many (or Many-to-One)
Many-to-Many
One-to-One
One-to-Many
Example: Department–Employee association.
A department can have multiple employees; each employee belongs to one departmen ...
Posted on Sun, 30 Aug 2026 16:52:43 +0000 by skorp
Advanced SQL Query Challenges: 15 Practical Problems and Solutions
SELECT COUNT(instructor_id) FROM instructors WHERE instructor_name LIKE 'Li%';
This query counts the number of instructors whose last name starts with "Li" by using the LIKE operator with a wildcard pattern.
Problem 2: Find students who scored higher in course "01" than in course "02"
SELECT st.student_id, crs1.s ...
Posted on Tue, 19 May 2026 08:52:00 +0000 by sarakmo