29 Lecture
CS403
Midterm & Final Term Short Notes
Data Manipulation Language
Data Manipulation Language (DML) is a subset of SQL used to manipulate data stored in relational databases. It includes commands like SELECT, INSERT, UPDATE, and DELETE, which allow users to retrieve, add, modify, and delete data from tables. DM
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
- Which of the following DML command is used to insert new data into a table?
a) SELECT
b) INSERT
c) UPDATE
d) DELETE
Solution: b) INSERT
Which DML command is used to retrieve data from a table?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
Solution: d) SELECT
Which DML command is used to modify existing data in a table?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
Solution: b) UPDATE
Which DML command is used to delete data from a table?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
Solution: c) DELETE
Which of the following is not a type of SQL join used in DML?
a) INNER JOIN
b) OUTER JOIN
c) UNION JOIN
d) FULL OUTER JOIN
Solution: c) UNION JOIN
Which DML command is used to add a new column to an existing table?
a) ADD COLUMN
b) INSERT COLUMN
c) UPDATE COLUMN
d) ALTER TABLE
Solution: d) ALTER TABLE
Which DML command is used to rename an existing table?
a) RENAME TABLE
b) UPDATE TABLE
c) ALTER TABLE
d) MODIFY TABLE
Solution: a) RENAME TABLE
Which DML command is used to change the data type of an existing column in a table?
a) MODIFY COLUMN
b) CHANGE COLUMN
c) ALTER COLUMN
d) UPDATE COLUMN
Solution: c) ALTER COLUMN
Which of the following is not a valid data type in SQL used in DML?
a) FLOAT
b) BOOLEAN
c) DECIMAL
d) ARRAY
Solution: d) ARRAY
Which DML command is used to update multiple rows in a table at once?
a) UPDATE
b) INSERT
c) DELETE
d) REPLACE
Solution: a) UPDATE
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
- What is Data Manipulation Language (DML)?
Answer: Data Manipulation Language (DML) is a subset of SQL used to manipulate data stored in relational databases. It includes commands like SELECT, INSERT, UPDATE, and DELETE, which allow users to retrieve, add, modify, and delete data from tables.
What is the purpose of the SELECT command in DML?
Answer: The SELECT command is used to retrieve data from a table in a database. It allows users to specify the columns and rows they want to retrieve and can be used to filter and sort data based on specific criteria.
What is the purpose of the INSERT command in DML?
Answer: The INSERT command is used to add new data to a table in a database. It allows users to specify the values they want to add for each column and can be used to add a single row or multiple rows at once.
What is the purpose of the UPDATE command in DML?
Answer: The UPDATE command is used to modify existing data in a table in a database. It allows users to change the values of one or more columns for one or more rows based on specific criteria.
What is the purpose of the DELETE command in DML?
Answer: The DELETE command is used to remove data from a table in a database. It allows users to delete one or more rows based on specific criteria.
What is a join in SQL used in DML?
Answer: A join in SQL is used to combine data from two or more tables based on a common column or set of columns. Joins are used in DML to retrieve data from multiple tables at once.
What is the purpose of the WHERE clause in DML?
Answer: The WHERE clause is used to filter data based on specific criteria in DML commands like SELECT, UPDATE, and DELETE. It allows users to specify conditions that must be met for rows to be included in the output.
What is the purpose of the ORDER BY clause in DML?
Answer: The ORDER BY clause is used to sort data in ascending or descending order based on specific columns in DML commands like SELECT. It allows users to control the order in which data is displayed in the output.
What is the purpose of the GROUP BY clause in DML?
Answer: The GROUP BY clause is used to group data based on specific columns in DML commands like SELECT. It allows users to aggregate data and perform calculations like counting, summing, and averaging.
What is the purpose of the HAVING clause in DML?
Answer: The HAVING clause is used to filter data based on specific criteria in DML commands that use the GROUP BY clause. It allows users to specify conditions that must be met for groups of rows to be included in the output.
Data Manipulation Language (DML) is an essential part of SQL (Structured Query Language) that is used to manipulate and modify data stored in a relational database. DML commands allow users to retrieve, add, modify, and delete data from tables, which is critical for data processing and management.
DML commands include SELECT, INSERT, UPDATE, and DELETE, which are used to perform specific tasks. The SELECT command retrieves data from one or more tables based on specific conditions, allowing users to filter and sort data based on their requirements. The INSERT command is used to add new data to a table, while the UPDATE command modifies existing data in a table. The DELETE command removes data from a table based on specific criteria.
Joins are also an essential part of DML and SQL, which allow users to combine data from two or more tables based on common columns. There are several types of joins, including INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN, that can be used based on specific requirements.
In addition to these basic commands, DML also includes clauses like WHERE, ORDER BY, GROUP BY, and HAVING. The WHERE clause is used to filter data based on specific criteria, while the ORDER BY clause sorts data based on specific columns in ascending or descending order. The GROUP BY clause is used to group data based on specific columns, while the HAVING clause is used to filter grouped data based on specific criteria.
DML commands are critical for data analysis and decision-making, as they provide a foundation for extracting useful information from large datasets, updating records, and ensuring data consistency and accuracy. Understanding DML is essential for anyone working with databases, and it plays a vital role in various industries, including finance, healthcare, e-commerce, and more.
In conclusion, DML is an essential subset of SQL that allows users to manipulate data stored in a relational database. It includes commands like SELECT, INSERT, UPDATE, and DELETE, which allow users to retrieve, add, modify, and delete data from tables. DML is critical for data processing and management and is used in various industries to extract useful information from large datasets, update records, and ensure data consistency and accuracy.