A. select
B. insert
C. update
D. All of the mentioned
The correct option is D. All of the mentioned. In SQL, the standard privileges include SELECT, INSERT, and UPDATE. These privileges allow users to perform various operations on database tables. These functions come under the data manipulation language, which is a part of the SQL programming language.
Table of Content
Basic SQL Commands
SQL stands for Structured Query Language. It is a query language developed to manipulate and manage the database system. It is used to manage a database by modifying, inserting, retrieving, deleting, and updating the records.
Let’s learn more about the basic commands of SQL
1. The SELECT command in SQL
The SELECT command in SQL will allow the user to retrieve data from their database.
For example, if you have a database with data on employees working in a company, there will be hundreds of employees in each department. Now, if you want to retrieve the employees from a particular department, you can use the Select command.
Example
SELECT * FROM employees;
SELECT name, position FROM employees WHERE department = 'Sales';
2. The INSERT command in SQL
The INSERT command in SQL query language will help you to insert any new data in the existing file.
For example, if you want to insert or add new data into the database records, like a new employee register, you can use the INSERT command. You just need to add all the information about the employee and insert their details into their respective department.
Example
#This will select the name and department of the employee
SELECT name, position FROM employees;
#This will insert the details of the new employee into the records.
INSERT INTO employees (id, name, position) VALUES (1, 'John Doe', 'Developer');
Explanation
In the above example, the first query retrieves the name and position of all employees from the employee’s table. The second query inserts a new employee’s record with ID 1, name ‘John Doe’, and position ‘Developer’ into the employee’s table.
3. UPDATE command in SQL
The UPDATE command will help you to update the database based on user preferences or if you want to change the details of a particular employee from a particular department you can use the UPDATE command. This will replace the existing details and add new details to the database.
For example, if John Doe is an employee with an employee ID of 1 and his department is “Developer”. Now, if you want to change his department to “Senior Developer,” you can use the UPDATE command to modify this information.
Example
UPDATE employees SET position = 'Senior Developer' WHERE id = 1;
Explanation
The SET position command will set the new position of the employee which is his department and the WHERE command will find the id of the employee for whom we are modifying the department.
Conclusion
Hence, we can conclude that all the commands like ‘SELECT’, ‘INSERT’, and ‘UPDATE’ are used to retrieve, add, and alter the data based on conditions or needs. It is important and useful to learn these commands for better performance and accessibility. To learn more about the SQL language check out our SQL course.