Q31
Q31 What is the primary purpose of the GRANT command in SQL?
To create a new table
To delete data from a table
To give users access privileges
To update table data
Q32
Q32 What does the REVOKE command do in SQL?
Adds new user accounts
Removes specific access privileges from users
Deletes tables
Inserts data
Q33
Q33 Which part of this statement is incorrect?
"GRANT SELECT ON Employees TO user123;"
GRANT
SELECT ON
Employees
All Correct
Q34
Q34 Identify the error in
"REVOKE INSERT, UPDATE ON Database FROM user123;"
REVOKE
INSERT, UPDATE
ON Database
FROM user123
Q35
Q35 What is the purpose of the COMMIT command in SQL?
To start a transaction
To save changes made by a transaction
To undo changes made by a transaction
To revoke user permissions
Q36
Q36 What does the ROLLBACK command do in a transaction?
Starts a new transaction
Saves the transaction changes
Restores the database to the state before the transaction started
Grants user permissions
Q37
Q37 How does a transaction in SQL ensure data consistency?
By locking the entire database
By allowing only one transaction at a time
By maintaining a log of all operations
By saving changes at regular intervals
Q38
Q38 In the statement "BEGIN TRANSACTION; UPDATE Employees SET Age = Age + 1; COMMIT;",
what needs correction?
BEGIN TRANSACTION
UPDATE Employees
SET Age = Age + 1
All Correct
Q39
Q39 Identify the issue in
"ROLLBACK TRANSACTION TO Savepoint1;"
ROLLBACK TRANSACTION
TO
Savepoint1
No issue
Q40
Q40 Correct the error in
"COMMIT WORK;"
COMMIT
WORK
No error
Semicolon
Q41
Q41 What is the primary role of a primary key in a database table?
To sort data
To identify unique records
To establish relationships with other tables
To check data integrity
Q42
Q42 Which constraint ensures that a column cannot have a NULL value?
PRIMARY KEY
FOREIGN KEY
UNIQUE
NOT NULL
Q43
Q43 What does the UNIQUE constraint in SQL do?
Prevents duplicate values in a column
Links two tables together
Automatically updates a column
Creates a new table
Q44
Q44 What is the purpose of the FOREIGN KEY constraint?
To create a new table
To ensure unique values in a column
To establish a link between two tables
To validate data format
Q45
Q45 Which constraint is used to define a condition that each row must satisfy in a SQL table?
DEFAULT
CHECK
PRIMARY KEY
UNIQUE
Q46
Q46 How does the DEFAULT constraint function in SQL?
It provides a default value for a column when no value is specified
It sets default permissions for users
It creates default tables
It sets default sorting for data
Q47
Q47 Identify the error in
"CREATE TABLE Orders (OrderID int PRIMARY KEY, ProductID int FOREIGN);"
CREATE TABLE
PRIMARY KEY
FOREIGN
No error
Q48
Q48 What needs to be corrected in
"ALTER TABLE Employees ADD UNIQUE (EmployeeID, Name);"?
ALTER TABLE
ADD UNIQUE
(EmployeeID, Name)
All Correct
Q49
Q49 Correct the syntax error in
"CREATE TABLE Students (ID int NOT);"
CREATE TABLE
Students
ID int
NOT
Q50
Q50 In the statement
"CREATE TABLE Employees (ID int, Salary decimal DEFAULT 10000);",
identify the error.
CREATE TABLE
ID int
Salary decimal
No Error
Q51
Q51 Identify the issue in
"CREATE TABLE Orders (OrderID int, CustomerID int REFERENCES Customers);"
CREATE TABLE
OrderID int
CustomerID int
REFERENCES Customers
Q52
Q52 What is missing in
"ALTER TABLE Employees ADD CHECK (Age >= 18);"?
ALTER TABLE
ADD CHECK
(Age >= 18)
All Correct
Q53
Q53 Correct the error in
"CREATE TABLE Products (ProductID int, Price decimal CHECK Price > 0);"
CREATE TABLE
Price decimal
CHECK constraint usage
ProductID int
Q54
Q54 Which arithmetic operator is used for division in SQL?
"-"
"*"
"/"
"+"
Q55
Q55 In SQL, what does the logical operator AND do when used in a WHERE clause?
Selects a record if either condition is true
Selects a record if both conditions are true
Negates a condition
None of the above
Q56
Q56 What does the comparison operator '<>' do in SQL?
Checks for equality
Checks for inequality
Checks if less than
Checks if greater than
Q57
Q57 Which bitwise operator performs a logical AND operation on two expressions?
& (AND)
| (OR)
^ (XOR)
~ (NOT)
Q58
Q58 In SQL, how does the compound operator '+=' function?
Adds two values
Adds a value to a column's existing value
Subtracts one value from another
Concatenates strings
Q59
Q59 What needs correction in
"SELECT * FROM Employees WHERE Salary = 5000 AND Department = 'HR';"?
All Correct
= in Salary
AND
= in Department
Q60
Q60 Identify the error in
"SELECT * FROM Orders WHERE OrderDate >= '2023-01-01' OR >= '2023-06-01';"
OR operator
>= '2023-06-01'
No error
The date format