9.2

SQL

10 flashcards to master SQL

Smart Spaced Repetition

Rate each card Hard, Okay, or Easy after flipping. Your progress is saved and cards are scheduled for optimal review intervals.

Definition Flip

What is SQL and what is its primary purpose?

Answer Flip

SQL stands for Structured Query Language. It is a programming language designed for managing and manipulating data held in a relational database management system (RDBMS). Its primary purpose is to query, insert, update, and delete data.

Key Concept Flip

Explain the function of the `SELECT` statement in SQL, providing an example.

Answer Flip

The `SELECT` statement retrieves data from one or more tables in a database.

Example: `SELECT student_name, student_id FROM Students;` would retrieve the name and ID from the 'Students' table.
Definition Flip

What is the purpose of the `FROM` keyword in an SQL query?

Answer Flip

The `FROM` keyword specifies the table(s) from which to retrieve data. It is essential as it tells the database where to find the data specified in the `SELECT` statement.

Key Concept Flip

Describe the function of the `WHERE` clause in SQL and give an example of its usage.

Answer Flip

The `WHERE` clause filters records based on a specified condition.

Example: `SELECT * FROM Products WHERE price > 50;` selects all products where the price is greater than 50.
Key Concept Flip

How does the `ORDER BY` clause affect the output of an SQL query? Give an example.

Answer Flip

The `ORDER BY` clause sorts the result-set in ascending or descending order.

Example: `SELECT * FROM Customers ORDER BY last_name DESC;` sorts customers by last name in descending order.
Definition Flip

Explain the difference between the `AND` and `OR` operators in a `WHERE` clause.

Answer Flip

The `AND` operator displays a record if all the conditions are true. The `OR` operator displays a record if any of the conditions are true. `AND` requires all conditions to be met, `OR` requires at least one.

Key Concept Flip

What is the purpose of the `INSERT` statement in SQL? Give an example.

Answer Flip

The `INSERT` statement adds new rows of data into a table.

Example: `INSERT INTO Employees (employee_id, first_name, last_name) VALUES (101, 'John', 'Doe');` inserts a new employee.
Key Concept Flip

Describe the functionality of the `UPDATE` statement in SQL and give an example.

Answer Flip

The `UPDATE` statement modifies existing records in a table.

Example: `UPDATE Products SET price = 60 WHERE product_id = 5;` updates the price of product with ID 5 to 60.
Key Concept Flip

Explain how the `DELETE` statement is used in SQL and provide an example.

Answer Flip

The `DELETE` statement removes existing records from a table.

Example: `DELETE FROM Customers WHERE customer_id = 123;` deletes the customer with ID 123.
Definition Flip

What is the purpose of the `CREATE TABLE` statement in SQL?

Answer Flip

The `CREATE TABLE` statement creates a new table in the database. It defines the table name and the structure of its columns (name, data type, constraints).

Test yourself

Practice with MCQ questions to check your understanding.

Take Quiz
9.1 Database concepts 10.1 Boolean logic

Key Questions: SQL

What is SQL and what is its primary purpose?

SQL stands for Structured Query Language. It is a programming language designed for managing and manipulating data held in a relational database management system (RDBMS). Its primary purpose is to query, insert, update, and delete data.

What is the purpose of the `FROM` keyword in an SQL query?

The `FROM` keyword specifies the table(s) from which to retrieve data. It is essential as it tells the database where to find the data specified in the `SELECT` statement.

Explain the difference between the `AND` and `OR` operators in a `WHERE` clause.

The `AND` operator displays a record if all the conditions are true. The `OR` operator displays a record if any of the conditions are true. `AND` requires all conditions to be met, `OR` requires at least one.

What is the purpose of the `CREATE TABLE` statement in SQL?

The `CREATE TABLE` statement creates a new table in the database. It defines the table name and the structure of its columns (name, data type, constraints).

About SQL (9.2)

These 10 flashcards cover everything you need to know about SQL for your Cambridge IGCSE Computer Science (0478) exam. Each card is designed based on the official syllabus requirements.

What You'll Learn

How to Study Effectively

Use the Study Mode button above to test yourself one card at a time. Try to answer each question before flipping the card. Review cards you find difficult more frequently.

Continue Learning

After mastering SQL, explore these related topics: