What is SQL primarily used for in the context of relational databases?
2024
What is SQL primarily used for in the context of relational databases?
- A.
To design user interfaces
- B.
To create and manipulate databases
- C.
To display data on web pages
- D.
To format printed reports
Attempted by 2088 students.
Show answer & explanation
Correct answer: B
Primary purpose: SQL is used to create, query, update, and manage relational databases.
Define and modify database structure (Data Definition Language): CREATE, ALTER, DROP.
Insert, update, delete, and retrieve data (Data Manipulation Language): INSERT, UPDATE, DELETE, SELECT.
Manage access and permissions (Data Control Language) and handle transactions (Transaction Control Language).
Example commands:
SELECT to query data, e.g., SELECT name FROM employees WHERE department = 'Sales';
INSERT to add rows, e.g., INSERT INTO employees (name, department) VALUES ('Alex', 'Sales');
CREATE TABLE to define tables and schema.
Note: While SQL provides the data, displaying or formatting that data for web pages or printed reports is handled by application code or reporting tools.
A video solution is available for this question — log in and enroll to watch it.