You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers the fundamentals of SQL (Structured Query Language) for the OCR A-Level Computer Science (H446) specification. SQL is the standard language for managing and querying relational databases.
SQL (Structured Query Language) is a declarative language used to:
SQL is declarative -- you describe WHAT data you want, not HOW to get it. The database engine determines the most efficient way to execute the query.
The SELECT statement retrieves data from one or more tables.
SELECT column1, column2
FROM table_name
WHERE condition
ORDER BY column ASC|DESC;
-- Select all columns from Students
SELECT * FROM Students;
-- Select specific columns
SELECT Name, Age FROM Students;
-- Select with a condition
SELECT Name, Grade FROM Students WHERE Grade = 'A';
-- Select with multiple conditions
SELECT Name, Age FROM Students WHERE Age >= 16 AND Grade = 'A';
-- Select with OR
SELECT Name FROM Students WHERE Subject = 'Maths' OR Subject = 'Science';
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.