Q181
Q181 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
Q182
Q182 What does the REVOKE command do in SQL?
Adds new user accounts
Removes specific access privileges from users
Deletes tables
Inserts data
Q183
Q183 Which part of this statement is incorrect? "GRANT SELECT ON Employees TO user123;"
Change 'GRANT' to 'GIVE'
Replace 'SELECT ON' with 'SELECT FROM'
Change 'user123' to 'User:123'
No error
Q184
Q184 Identify the error in
"REVOKE INSERT, UPDATE ON Database FROM user123;"
REVOKE
INSERT, UPDATE
ON Database
FROM user123
Q185
Q185 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
Q186
Q186 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
Q187
Q187 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
Q188
Q188 In the statement "BEGIN TRANSACTION; UPDATE Employees SET Age = Age + 1; COMMIT;", what needs correction?
Remove 'BEGIN TRANSACTION'
Replace 'COMMIT' with 'END TRANSACTION'
Change 'SET Age = Age + 1' to 'SET Age = Age - 1'
No error
Q189
Q189 Identify the issue in "ROLLBACK TRANSACTION TO Savepoint1;"
Change 'ROLLBACK' to 'REVERT'
Remove 'TO'
Replace 'Savepoint1' with 'SAVEPOINT1'
No error
Q190
Q190 Correct the error in "COMMIT WORK;"
Change 'COMMIT' to 'FINISH'
Replace 'WORK' with 'TRANSACTION'
Add 'TRANSACTION' after 'COMMIT'
No error
Q191
Q191 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
Q192
Q192 Which constraint ensures that a column cannot have a NULL value?
PRIMARY KEY
FOREIGN KEY
UNIQUE
NOT NULL
Q193
Q193 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
Q194
Q194 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
Q195
Q195 Which constraint is used to define a condition that each row must satisfy in a SQL table?
DEFAULT
CHECK
PRIMARY KEY
UNIQUE
Q196
Q196 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
Q197
Q197 Identify the error in
"CREATE TABLE Orders (OrderID int PRIMARY KEY, ProductID int FOREIGN);"
CREATE TABLE
PRIMARY KEY
FOREIGN
No error
Q198
Q198 What needs to be corrected in "ALTER TABLE Employees ADD UNIQUE (EmployeeID, Name);"?
Change 'ADD' to 'CREATE'
Remove 'UNIQUE'
Replace '(EmployeeID, Name)' with 'EmployeeID, Name'
No error
Q199
Q199 Correct the syntax error in
"CREATE TABLE Students (ID int NOT);"
CREATE TABLE
Students
ID int
NOT
Q200
Q200 In the statement "CREATE TABLE Employees (ID int, Salary decimal DEFAULT 10000);", identify the error.
Change 'int' to 'integer'
Remove 'DEFAULT 10000'
Replace 'decimal' with 'number'
No error
Q201
Q201 Identify the issue in
"CREATE TABLE Orders (OrderID int, CustomerID int REFERENCES Customers);"
CREATE TABLE
OrderID int
CustomerID int
REFERENCES Customers
Q202
Q202 What is missing in "ALTER TABLE Employees ADD CHECK (Age >= 18);"?
Add 'CONSTRAINT'
Change 'Age >= 18' to 'Age > 18'
Include column name before 'CHECK'
No error
Q203
Q203 Correct the error in
"CREATE TABLE Products (ProductID int, Price decimal CHECK Price > 0);"
CREATE TABLE
Price decimal
CHECK constraint usage
ProductID int
Q204
Q204 Which arithmetic operator is used for division in SQL?
"-"
"*"
"/"
"+"
Q205
Q205 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
Q206
Q206 What does the comparison operator '<>' do in SQL?
Checks for equality
Checks for inequality
Checks if less than
Checks if greater than
Q207
Q207 Which bitwise operator performs a logical AND operation on two expressions?
& (AND)
| (OR)
^ (XOR)
~ (NOT)
Q208
Q208 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
Q209
Q209 What needs correction in "SELECT * FROM Employees WHERE Salary = 5000 AND Department = 'HR';"?
Replace '*' with 'Name, Salary'
Change '=' to '!=' in 'Salary = 5000'
Replace 'AND' with 'OR'
No error
Q210
Q210 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