Database Manipulation Language

Fill in the blanks

A "derived field" in SQL refers to a field (or column) whose value is calculated or derived from one or more other fields in the database. This can be achieved through a database query, often using SQL. Suppose you have a database table named sales with two columns: quantity and unit_price. You want to create a derived field total_price, which is the product of and . The SQL query to achieve this would be: SELECT quantity, unit_price, (quantity * unit_price) AS total_price FROM sales;



A parameter query in a database is a type of query where one or more of the criteria for the query are provided as , rather than being hard-coded in the query itself. This approach is commonly used to create flexible and dynamic queries, allowing users to specify the exact criteria for the query at runtime. The SQL query might look something like this: SELECT id, name FROM employees WHERE department = ?; In this query, the ? is a placeholder for the department parameter. When you run this query, you'll provide the actual name as a parameter.



In SQL, Boolean operators are used to form conditions in queries, allowing you to filter data based on specific criteria. The primary Boolean operators in SQL are , , and NOT. For example, you can use these operators to write a SQL query like: SELECT * FROM employees WHERE (department = 'Sales' OR department = 'Marketing') AND salary > 50000; In this query, the parentheses ensure that the OR condition is evaluated first, and then the AND condition.



SQL Data Manipulation Language (DML) queries are used to manipulate data within tables in a database. These include operations like inserting, updating, deleting, and (selecting) data. The four types are: SELECT, INSERT, DELETE, and . Each of these operations has its own syntax and use cases, such as using SELECT to retrieve data based on specific conditions or using UPDATE to modify existing records in a table based on specified criteria.

Keywords

department | retrieving | update | parameters | quantity | and | or | unit_price |