Q: 1 Which type of language allows a user to specify what task is to be done without specifying how the task will be accomplished?
Programming Language
Database Language
Query Language
User Oriented Language
[ Option C ]
A Query Language allows users to specify what data they want rather than how the data should be retrieved.
For example, in SQL, a user can write a query to fetch required records without worrying about the internal procedures used by the DBMS to access the data. This makes query languages Non-Procedural and easy to use.
Q: 2 A technique called __________ can be used by malicious hackers to steal data or damage the database.
SQL injection
SQL assertion
SQL trigger
SQL procedure
[ Option A ]
SQL Injection is a malicious technique in which attackers provide crafted input to SQL queries, tricking the database into executing unintended commands. This can lead to unauthorized data access, modification, or deletion. It is a major security concern for databases connected to web applications.
Q: 3 Which SQL command is used to take back a privilege from a user?
GRANT
REVOKE
DELETE
MODIFY
[ Option B ]
In SQL, the REVOKE command is used to remove privileges that were previously granted to a user.
Q: 4 Consider the SQL command, DELETE [FROM] table [WHERE condition]; What happens if the WHERE clause is omitted?
All rows in the table are deleted.
It will give you an error.
No rows will be deleted.
Only one row will be deleted.
[ Option A ]
In SQL, the DELETE statement removes rows that satisfy the WHERE condition. If the WHERE clause is omitted, there is no condition to restrict the deletion, so all rows in the table are deleted. The table structure remains intact.
The SQL command DELETE FROM Student; deletes every record from the Student table.
Q: 5 In SQL triggers, the action part can be executed in which of the following ways?
Only once for all affected tuples
Only once per transaction
Either once for each modified tuple or once for all tuples changed in the operation
Only before an update operation
[ Option C ]
A Trigger in SQL is a set of actions automatically executed by the database in response to a specific event, such as an INSERT, UPDATE, or DELETE on a table. Triggers are often used for tasks like maintaining audit logs, enforcing business rules, or validating data automatically.
The action part of a trigger (the code that gets executed) can be performed in two ways:
Row-Level Trigger: The trigger is executed once for every row (tuple) that is modified by the operation.
Statement-Level Trigger: The trigger is executed only once, regardless of how many tuples are affected by the operation.
Q: 6 Which of the following statement contains an error?
Select * from emp where empid = 10003;
Select empid from emp where empid = 1006;
Select empid from emp;
Select empid where empid = 10009 and last name = ‘GELIER’;
[ Option D ]
The error in this SQL statement occurs because the FROM clause is missing, which is required to specify the table from which data should be retrieved. A correct SELECT query must always include the FROM keyword followed by the table name. Additionally, if a column name contains spaces (for example, last name), it should be enclosed in quotes or brackets to avoid syntax errors.
| Syntax Pattern | Description |
|---|---|
| SELECT column1, column2, ... FROM table; | Select specific columns from a table. |
| SELECT * FROM table; | Select all columns from a table. |
| SELECT DISTINCT column FROM table; | Select unique or distinct values from a column. |
| SELECT column1, column2 FROM table WHERE condition; | Select with filtering rows based on condition. |
| SELECT column1, COUNT(*) FROM table GROUP BY column1; | Select grouped data with aggregation function. |
| SELECT column1, COUNT(*) FROM table GROUP BY column1 HAVING condition; | Grouped data with filtering on groups. |
| SELECT column1, column2 FROM table ORDER BY column1 ASC | Select specific columns from a table and arrange them either in ascending (ASC) or descending (DESC) order. |
| SELECT column1 INTO new_table FROM old_table; | Create new table by copying selected data from another table. |
| SELECT column1 FROM table1 JOIN table2 ON table1.col = table2.col; | Select data combining rows from two tables with join condition. |
Q: 7 Which of the following helps a user to hide data in a database?
Primary Key
Foreign Key
View
Table
[ Option C ]
A View is a virtual table created using a SELECT query. It allows users to see only specific columns or rows of a table while hiding the remaining data. This is commonly used for data security and access control.
E.g.:
CREATE VIEW Employee_View AS
SELECT Empid, Name
FROM Employee;
Here, users can see only Empid and Name, while other sensitive columns like salary, designation, or address remain hidden.
Q: 8 Which SQL statement is used in embedded SQL to fetch data into host variables?
INSERT INTO
UPDATE
DELETE
SELECT INTO
[ Option D ]
In embedded SQL, we write SQL statements inside a host programming language like C, Java, or COBOL. When we want to fetch data from a table and store it directly into host variables, we use the SELECT INTO statement.
The SELECT is used to read data from a table.
The INTO is used to store the fetched values into host language variables.
EXEC SQL SELECT column_name INTO :host_name FROM table_name WHERE condition;
E.g.:
Host variables in C:
char student_name[50];
int student_marks;
Embedded SQL SELECT INTO:
EXEC SQL SELECT name, marks
INTO :student_name, :student_marks
FROM Student
WHERE roll_no=101;
Q: 9 SQL is a:
Procedural Language
Non-Procedural Language
Computer Language
Compiler
[ Option B ]
SQL (Structured Query Language) is a Non-Procedural or Declarative language, which means the user specifies what data is required, not how to retrieve it. The DBMS decides the best way to execute the query.
Q: 10 Which of the following is valid pair of schema change statements in SQL?
DELETE, ALTER
DROP, UPDATE
DROP, ALTER
DELETE, UPDATE
[ Option C ]
Schema change statements in SQL are used to modify the structure of existing database objects like tables, columns, or constraints. These changes can include adding or removing tables, columns, or other schema elements. The most common schema change statements are DROP and ALTER.
Q: 11 Which of the following database object does not physically exist?
Base Table
Index
View
None of the above
[ Option C ]
A view in a database is a virtual table that represents the data retrieved by a stored SQL query from one or more base tables.
Unlike base tables and indexes, which physically exist and store data on disk, a view does not store data itself. Instead, it holds only the SQL query defining it.
When a user queries the view, the database engine executes the stored query dynamically on the underlying base tables to fetch the current data. This allows views to provide a customized and simplified representation of data, enforce security by controlling data access, and reduce complexity without duplicating storage.
Views serve as logical abstractions that help organize and present data efficiently without physically occupying storage space.
Q: 12 In SQL ________ is an aggregate function.
SELECT
CREATE
AVG
MODIFY
[ Option C ]
An aggregate function in SQL performs a calculation on a set of values and returns a single summarized result. These functions are commonly used to analyze and summarize data, especially when combined with the GROUP BY clause. The aggregate functions include:
Aggregate functions help in generating reports, insights, and statistical summaries from large datasets efficiently.
Q: 13 We want to add to the relation Studio(name, address, president), all movie studios that are mentioned in the relation Movie(title, year, length, incolour, studioName, producer) but do not appear in Studio. What will be the correct query for this?
INSERT INTO Studio(name) SELECT DISTINCT studioName FROM Movie WHERE studioName NOT IN (SELECT name FROM Studio);
INSERT INTO Studio(name) values as SELECT DISTINCT studioName FROM Movie WHERE studioName NOT IN (SELECT name FROM Studio);
INSERT INTO Studio SELECT DISTINCT studioName FROM Movie WHERE studioName NOT IN (SELECT name FROM Studio);
INSERT INTO Studio(name) values SELECT DISTINCT studioName FROM Movie WHERE studioName NOT IN (SELECT name FROM Studio);
[ Option A ]
The goal is to insert into the Studio table the names of all studios that appear in the Movie relation but are not already present in Studio.
To insert into the relation Studio all studios that appear in the Movie relation but are not already present, we use the INSERT INTO ... SELECT statement. The correct query is:
INSERT INTO Studio(name)
SELECT DISTINCT studioName
FROM Movie
WHERE studioName NOT IN (SELECT name FROM Studio);
This query selects all unique studio names from the Movie table and inserts them into the Studio table, but only if they do not already exist in Studio. The DISTINCT keyword ensures that duplicate names are not inserted, and the NOT IN condition prevents inserting studios already present.
Q: 14 Which of the following SQL aggregate functions ignore NULL values?
Max
Count
Sum
All of the above
[ Option D ]
In SQL, aggregate functions generally ignore NULL values while performing calculations.
Q: 15 Consider the following SQL query to retrieve Cust_ID of the customers from CUSTOMER table, whose name contains P as second character and ends with A
SELECT Cust_ID
FROM CUSTOMER
WHERE _________;
Which of the following is most suitable to complete the query?
name like '_P%A'
name like '$P%A'
name like '2P$A'
name like '%P_A'
[ Option A ]
In SQL, the LIKE operator is used with wildcard characters to match patterns in string data. The two main wildcards are:
| WILDCARD CHARACTER | DESCRIPTION | EXAMPLE | RESULT |
|---|---|---|---|
| _ (Underscore) | Represents exactly one character. | 'A_P' | ACP, ABP, A2P |
| % (Percent) | Represents zero or more characters. | 'A%P' | AP, ABP, ABBP, APQRP |
In the given query, we need to find customer names where the second character is ‘P’ and the name ends with ‘A’.
Thus, the correct pattern is '_P%A', which means, any first character (_), followed by ‘P’, then any number of characters (%), and ending with ‘A’.
Q: 16 Which of the following SQL statements is a DDL command?
INSERT
UPDATE
DELETE
ALTER
[ Option D ]
In SQL, commands are categorized into DDL, DML, DQL, DCL and TCL based on their purpose.
| Category | Command | Description | Example |
|---|---|---|---|
DDL (Data Definition Language) Defines and manages the structure of the database and its objects. | CREATE | Creates a new database, table, or other database object. | CREATE TABLE Students (Rollno INT, Name VARCHAR(50)); |
| ALTER | Modifies the structure of an existing database object (add/drop column, change datatype). | ALTER TABLE Students ADD Age INT; | |
| DROP | Deletes a database, table, or object permanently. | DROP TABLE Students; | |
| TRUNCATE | Deletes all rows from a table but keeps the table structure. | TRUNCATE TABLE Students; | |
| RENAME | Renames a table or database object. | ALTER TABLE Students RENAME TO PGStudent; | |
DML (Data Manipulation Language) Used to manipulate or modify data stored in the database tables. | INSERT | Adds new rows (tuples) to a table. | INSERT INTO Students VALUES (1001, 'Suresh'); |
| UPDATE | Modifies existing rows in a table. | UPDATE Students SET Age = 31 WHERE Rollno = 1001; | |
| DELETE | Removes specific rows from a table. | DELETE FROM Students WHERE Rollno= 1001; | |
DCL (Data Control Language) Controls access and permissions to the database. | GRANT | Gives privileges/permissions to users. | GRANT SELECT, INSERT ON Students TO User1; |
| REVOKE | Removes privileges/permissions from users. | REVOKE INSERT ON Students FROM User1; | |
DQL (Data Query Language) Used to retrieve data from the database. | SELECT | Retrieves data from one or more tables. | SELECT Name, Age FROM Students; |
TCL (Transaction Control Language) Manages transactions to ensure data integrity and consistency. | COMMIT | Saves all changes made in the current transaction permanently. | COMMIT; |
| ROLLBACK | Undoes all changes made in the current transaction. | ROLLBACK; | |
| SAVEPOINT | Sets a point within a transaction to which you can roll back. | SAVEPOINT sp1; |
Q: 17 In SQL, which keyword is used to compare strings using patterns?
AS
LIKE
SAME
EQUAL
[ Option B ]
In SQL, the LIKE keyword is used to compare string values based on patterns using wildcard characters such as % (represents any number of characters) and _ (represents a single character).
E.g.:
SELECT * FROM Employee
WHERE name LIKE 'S%';
This query selects all Employee whose names start with the letter S.
Q: 18 A/An ___________ is any condition that the database must always satisfy. Domain constraints and referential-integrity constraints are special forms of ___________. Choose the ordered pair to correctly fill in the blanks.
trigger, assertion
assertion, trigger
procedure, function
assertion, assertion
[ Option D ]
In a database, an Assertion is a logical condition that defines a rule or constraint which must always be satisfied by the data in the database. It ensures the consistency and correctness of stored data.
Common examples of assertions include domain constraints, which restrict the permissible values of an attribute, and referential integrity constraints, which ensure valid relationships between tables.
Q: 19 Which of the following SQL operations is used to remove a specific tuple from a relation?
DROP
DELETE
TRUNCATE
REMOVE
[ Option B ]
In SQL, removing data from a table can be done using different commands, but each serves a different purpose. The DROP command deletes the entire table (with all its data and structure), while TRUNCATE removes all rows quickly but keeps the table structure.
To remove a specific tuple or row from a table, the DELETE statement is used with a WHERE clause to target the exact tuple. If no condition is given (in WHERE clause), all rows are deleted but the table structure remains. This ensures that only the intended row is deleted without affecting the rest of the table.
A Database Object is any structure or entity in a database that is created to store, manage, or manipulate data. Examples of database objects include tables, views, indexes, sequences, triggers, procedures, functions, etc.
| Category | Command | Description | Example |
|---|---|---|---|
| DDL (Data Definition Language) | CREATE | Creates a new database, table, or other database object. | CREATE TABLE Students (Rollno INT, Name VARCHAR(50)); |
| ALTER | Modifies the structure of an existing database object (add/drop column, change datatype). | ALTER TABLE Students ADD Age INT; | |
| DROP | Deletes a database, table, or object permanently. | DROP TABLE Students; | |
| TRUNCATE | Deletes all rows from a table but keeps the table structure. | TRUNCATE TABLE Students; | |
| RENAME | Renames a table or database object. | ALTER TABLE Students RENAME TO PGStudent; | |
| DML (Data Manipulation Language) | INSERT | Adds new rows (tuples) to a table. | INSERT INTO Students VALUES (1001, 'Suresh'); |
| UPDATE | Modifies existing rows in a table. | UPDATE Students SET Age = 31 WHERE Rollno = 1001; | |
| DELETE | Removes specific rows from a table. | DELETE FROM Students WHERE Rollno= 1001; | |
| DCL (Data Control Language) | GRANT | Gives privileges/permissions to users. | GRANT SELECT, INSERT ON Students TO User1; |
| REVOKE | Removes privileges/permissions from users. | REVOKE INSERT ON Students FROM User1; | |
| DQL (Data Query Language) | SELECT | Retrieves data from one or more tables. | SELECT Name, Age FROM Students; |
| TCL (Transaction Control Language) | COMMIT | Saves all changes made in the current transaction permanently. | COMMIT; |
| ROLLBACK | Undoes all changes made in the current transaction. | ROLLBACK; | |
| SAVEPOINT | Sets a point within a transaction to which you can roll back. | SAVEPOINT sp1; |
Q: 20 Which of the following language is used to define the schema of the database?
DCL
DDL
DML
None of the above
[ Option B ]
The schema of a database defines the structure of the database, including tables, columns, data types, and constraints. To create, modify, or delete this structure, Data Definition Language (DDL) is used in DBMS.
The DDL commands such as create, alter, and drop define and manage the database schema.
| Category | Command | Description | Example |
|---|---|---|---|
DDL (Data Definition Language) Defines and manages the structure of the database and its objects. | CREATE | Creates a new database, table, or other database object. | CREATE TABLE Students (Rollno INT, Name VARCHAR(50)); |
| ALTER | Modifies the structure of an existing database object (add/drop column, change datatype). | ALTER TABLE Students ADD Age INT; | |
| DROP | Deletes a database, table, or object permanently. | DROP TABLE Students; | |
| TRUNCATE | Deletes all rows from a table but keeps the table structure. | TRUNCATE TABLE Students; | |
| RENAME | Renames a table or database object. | ALTER TABLE Students RENAME TO PGStudent; |
Q: 21
Match the following—
| List – I | List – II |
|---|---|
| (A) DDL | (i) LOCK TABLE |
| (B) DML | (ii) COMMIT |
| (C) TCL | (iii) Natural Difference |
| (D) Binary Operation | (iv) REVOKE |
A-(ii), B-(i), C-(iii), D-(iv)
A-(i), B-(ii), C-(iv), D-(iii)
A-(iii), B-(ii), C-(i), D-(iv)
A-(iv), B-(i), C-(ii), D-(iii)
[ Option D ]
Q: 22 Which of the following is not a set operation in SQL?
Union
Intersect
Like
Minus
[ Option C ]
Set operations in SQL are used to combine or compare the results of two SELECT queries. Common set operations include UNION, INTERSECT, and MINUS or EXCEPT.
The LIKE is a pattern-matching operator used in the WHERE clause to filter rows based on string patterns.
Q: 23 In the context of SQL standard, which of the following statement(s) is/are true?
I: Table function can be used in a Query.
II: Procedures are invoked by using a call statement.
only I
only II
Both I and II
Neither I nor II
[ Option C ]
A table function is a user-defined function that returns a table and can be used within a query’s FROM clause, allowing it to behave like a regular table.
Similarly, stored procedures are invoked using the CALL statement, which is the standard method for executing procedures in SQL. Therefore, both statements I and II are correct.
Q: 24 What will the following SQL statement do? SELECT COUNT(*) FROM employees;
Count all the employees with NULL values
Count all rows in the employees table
Count only rows with non-NULL values
Return all count column values
[ Option B ]
In SQL, the COUNT() function is an aggregate function used to determine the number of records in a table. It can be used in different forms, such as COUNT(*), COUNT(Column_Name), and COUNT(DISTINCT Column_Name).
When we use COUNT(*), it counts all rows in the specified table, regardless of whether any column contains a NULL value. This means it simply counts the total number of entries present.
In the query SELECT COUNT(*) FROM employees;, the database counts all the rows in the employees table, including those having NULL values in one or more columns.
| FUNCTION | DESCRIPTION | EXAMPLE | OUTPUT |
|---|---|---|---|
| COUNT(*) | Counts all rows in a table, regardless of NULL values in any column. | SELECT COUNT(*) FROM employees; | If the table has 10 rows, including some with NULL, the result is 10. |
| COUNT (Column_Name) | Counts the number of Non-NULL values in a specific column. | SELECT COUNT(salary) FROM employees; | If 2 employees have NULL salaries out of 10, the result is 8. |
| COUNT(DISTINCT Column_Name) | Counts the number of unique (Non-NULL) values in a column. | SELECT COUNT(DISTINCT department) FROM employees; | If there are 10 rows but only 4 unique departments, the result is 4. |
Q: 25 The operation which can be used to specify automatic actions that the database system will perform when certain events and conditions occur is known as—
CREATE TRIGGER
CREATE VIEW
CREATE ASSERTION
CREATE TABLE
[ Option A ]
In SQL, the operation used to define automatic actions that the database system should perform when specific events occur (such as INSERT, UPDATE, or DELETE) is called Trigger. A trigger is a stored program that executes automatically whenever a specified event happens on a table.
Triggers help in maintaining data integrity, enforcing business rules, automating tasks like auditing changes, and validating data before or after modification. They run without explicit invocation by users, ensuring consistent and automatic enforcement of rules defined at the database level.
Q: 26 Which language is used to define the integrity constraints?
DCL
DDL
DML
None of the above
[ Option B ]
Integrity constraints are rules that ensure the accuracy, consistency, and validity of data in a database, such as Primary Key, Foreign Key, Unique, Not Null, and Check constraints.
These constraints are defined when creating or modifying the structure of database tables. In DBMS, Data Definition Language (DDL) is used to define the database schema, including tables and their constraints, using commands like Create and Alter.
| CONSTRAINT | DESCRIPTION |
|---|---|
| PRIMARY KEY | Ensures that each record in a table is uniquely identified. It does not allow NULL values. |
| FOREIGN KEY | Establishes a relationship between two tables by referencing the primary key of another table. |
| UNIQUE | Ensures that all values in a column are different. |
| NOT NULL | Prevents a column from having NULL values. |
| CHECK | Ensures that the values in a column satisfy a specific condition. For example, age int CHECK (age>=18). |
| DEFAULT | Assigns a default value to a column if no value is provided. |
Q: 27 Which language is used to permit or prohibit access of the table?
DCL
DDL
DML
None of the above
[ Option A ]
In a database system, controlling who can access a table and what operations they are allowed to perform is an important security feature. This task is handled by Data Control Language (DCL).
DCL commands are used to permit or prohibit access to database objects such as tables, views, and databases. Common DCL commands include GRANT, which gives access permissions, and REVOKE, which removes them.
Q: 28 Consider the relation course(courseld, cname, credits, deptNo) and two queries Q1 and Q2.
Q1: select deptNo, sum(credits) as totalCredits1 from course group by deptNo having totalCredits1 = ANY (select max(x.totalCredits) from (select sum(credits) as totalCredits from course group by deptNo) as x);
Q2: select deptNo, sum(credits) as totalCredits1 from course group by deptNo having totalCredits1 >= ALL (select sum(credits) from course group by deptNo);
Q1 will give same result as Q2.
Q2 result will be subset of Q1 result.
Q1 result will be subset of Q2 result.
Q1 and Q2 will give different results.
[ Option A ]
Both queries aim to find the department(s) with the maximum total credits from the course relation.
Query Q1 uses a nested subquery with ANY and MAX to select the department(s) whose total credits equal the maximum total credits.
Query Q2 uses >= ALL on a subquery that computes the total credits per department, which also selects department(s) having the highest total credits.
Q: 29 Which of the following is a valid value that can be stored in a variable of type NUMERIC (3,1) in SQL?
444.5
4.45
44.5
4.445
[ Option C ]
In SQL, a column defined as NUMERIC(3, 1) can store a total of three digits, out of which one digit is reserved for the decimal part and the remaining two for the integer part. Hence, valid numbers range approximately from –99.9 to 99.9. Among the given options, only 44.5 satisfies these conditions.
So, in SQL,
So, for NUMERIC(3, 1):
Q: 30 A view in SQL is defined by using the ____________ command. To define a view, the view is given a name and must state the ___________ that computes the view.
create view, query
define view, trigger
make view, trigger
show view, query
[ Option A ]
In SQL (Structured Query Language), a view is a virtual table that is created based on the result of a query. It does not store data physically.
To create a view, we use the CREATE VIEW command followed by the view name and a SELECT query that determines the view's contents.
CREATE VIEW view_name AS
SELECT column1, column2
FROM table_name
WHERE condition;
Q: 31 Which SQL keyword is used to eliminate duplicate records from the result set?
DISTINCT
DISTINCT ALL
LIKE
ORDER BY
[ Option A ]
In SQL, the DISTINCT keyword is used with the SELECT statement to remove duplicate rows from the query result.
E.g.:
SELECT DISTINCT City FROM Student;
This query returns each city only once, even if it appears multiple times in the table.
Q: 32 In an INSERT statement, if a date is required to be entered in a format other than the default (for example, specifying another century) and/or a specific time is required, which function must be used?
The TO-DATE function
The TO-CHAR function
The NVL function
None of the above
[ Option A ]
The TO_DATE function in SQL is used to convert a character string into a DATE value using a specified format. This is necessary when the date or time does not match the database default date format.
E.g.:
INSERT INTO Employee (empid, joindate)
VALUES (101, TO_DATE('22-02-2023 12:15', 'DD-MM-YYYY HH24:MI'));
Q: 33 Which of the following symbols is used in SQL to retrieve all columns from a table?
#
%
*
@
[ Option C ]
In SQL, the asterisk (*) symbol is used in the SELECT statement to indicate all columns of a table.
E.g.:
SELECT * FROM Student;
This query retrieves every column and all rows from the Student table.
Q: 34 To maintain materialized views in RDBMS, we use-
Trigger
Pointer
Clone Object
None
[ Option A ]
In a Relational Database Management System (RDBMS), a materialized view is a database object that stores the results of a query physically. Unlike a regular view, which calculates data only when it is accessed, a materialized view keeps the data ready in advance, which helps speed up complex queries.
Since the original tables can change with INSERT, UPDATE, or DELETE operations, the data in a materialized view can become outdated. To keep it current automatically, RDBMS uses triggers, which are special procedures that run whenever the underlying table data changes, ensuring the materialized view stays up-to-date.
Q: 35 Which of the following is a valid value that can be stored in a variable of type NUMERIC(4, 1) in SQL?
444.5
44.55
4.555
3333.5
[ Option A ]
In SQL, a column defined as NUMERIC(4, 1) can store a total of four digits, out of which one digit is reserved for the decimal part and the remaining three for the integer part. Hence, valid numbers range approximately from –999.9 to 999.9. Among the given options, only 444.5 satisfies these conditions.
So, in SQL,
So, for NUMERIC(4, 1):
Q: 36 In SQL, the expression 10/NULL evaluates to:
False
-1
Null
10
[ Option C ]
In SQL, any arithmetic operation involving NULL results in NULL. The value NULL represents an unknown or missing value, so dividing a number by NULL produces an unknown result, which is returned as NULL.
Q: 37 Set operations in SQL include:
Union
Intersection
Except
All of the above
[ Option D ]
Set operations are used in SQL to combine the results of two or more SELECT queries.
Q: 38 If SQL command DELETE FROM EMPLOYEE; is executed on relation EMPLOYEE having ‘n’ tuple in it, ____________ will be deleted from relation EMPLOYEE.
Zero Tuples
Only First Tuple
All ‘n’ Tuples
Only Last Tuple
[ Option C ]
The SQL command DELETE FROM EMPLOYEE; without a WHERE clause will delete all tuples (rows) from the EMPLOYEE relation or table. It removes every record, but the table structure, columns, and schema remain intact.
Q: 39 Which of the following operators can be used with the SELECT statement in SQL?
IN
BETWEEN
LIKE
All of the above
[ Option D ]
In SQL, the SELECT statement commonly uses conditions in the WHERE clause to filter records. The operators IN, BETWEEN, and LIKE are all used with SELECT to specify such conditions.
E.g.:
SELECT * FROM Student
WHERE marks BETWEEN 75 AND 95
AND name LIKE 'S%'
AND class IN ('BCA', 'MCA');
Q: 40 View in a database is –
A method to improve database performance
A physical table that stores data
A virtual table created by querying one or more tables
A backup copy of a database
[ Option C ]
In SQL (Structured Query Language), a view is a virtual table that is created based on the result of a query. It does not store data physically.
To create a view, we use the CREATE VIEW command followed by the view name and a SELECT query that determines the view's contents.
CREATE VIEW view_name AS
SELECT column1, column2
FROM table_name
WHERE condition;
Q: 41 Which set of SQL language commands is used to query and update a database?
Data Definition Language (DDL)
Both Data Control Language (DCL) and Data Definition Language (DDL)
Data Control Language (DCL)
Data Manipulation Language (DML)
[ Option D ]
The Data Manipulation Language (DML) is the part of SQL used to query and update data in a database.
| Category | Command | Description | Example |
|---|---|---|---|
| DDL (Data Definition Language) | CREATE | Creates a new database, table, or other database object. | CREATE TABLE Students (Rollno INT, Name VARCHAR(50)); |
| ALTER | Modifies the structure of an existing database object (add/drop column, change datatype). | ALTER TABLE Students ADD Age INT; | |
| DROP | Deletes a database, table, or object permanently. | DROP TABLE Students; | |
| TRUNCATE | Deletes all rows from a table but keeps the table structure. | TRUNCATE TABLE Students; | |
| RENAME | Renames a table or database object. | ALTER TABLE Students RENAME TO PGStudent; | |
| DML (Data Manipulation Language) | INSERT | Adds new rows (tuples) to a table. | INSERT INTO Students VALUES (1001, 'Suresh'); |
| UPDATE | Modifies existing rows in a table. | UPDATE Students SET Age = 31 WHERE Rollno = 1001; | |
| DELETE | Removes specific rows from a table. | DELETE FROM Students WHERE Rollno= 1001; | |
| DCL (Data Control Language) | GRANT | Gives privileges/permissions to users. | GRANT SELECT, INSERT ON Students TO User1; |
| REVOKE | Removes privileges/permissions from users. | REVOKE INSERT ON Students FROM User1; | |
| DQL (Data Query Language) | SELECT | Retrieves data from one or more tables. | SELECT Name, Age FROM Students; |
| TCL (Transaction Control Language) | COMMIT | Saves all changes made in the current transaction permanently. | COMMIT; |
| ROLLBACK | Undoes all changes made in the current transaction. | ROLLBACK; | |
| SAVEPOINT | Sets a point within a transaction to which you can roll back. | SAVEPOINT sp1; |
Q: 42 A NULL value indicates:
Absence of information about an attribute
Zero value of an attribute
Both (a) and (b)
None of these
[ Option A ]
In DBMS, NULL represents missing, unknown, or not applicable information. It does not mean zero, blank, or empty. It simply means that the value is not known or not provided.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.