Which of the following is not a type of integrity constraint in SQL?
Which of the following is true about a primary key constraint in SQL?
In SQL, which constraint is used to ensure that values in a column are unique across all rows in a table?
Which of the following is an example of a referential integrity constraint in SQL?
Consider the following SQL table definition:
CREATE TABLE Employees (
EmployeeID INT,
EmployeeName VARCHAR(50),
DepartmentID INT
);
Which of the following SQL statements adds a primary key constraint to the "EmployeeID" column?
Consider the following SQL table definition:
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
StudentName VARCHAR(50),
Age INT NOT NULL
);
Which of the following SQL statements adds a foreign key constraint to the "DepartmentID" column referencing the "Department" table?
Consider the following SQL table definition:
CREATE TABLE Orders (
OrderID INT PRIMARY KEY,
OrderDate DATE,
TotalAmount DECIMAL(10, 2)
);
Which of the following SQL statements adds a check constraint to the "TotalAmount" column to ensure that the value is greater than zero?
Consider the following SQL table definition:
CREATE TABLE Products (
ProductID INT PRIMARY KEY,
ProductName VARCHAR(50) UNIQUE,
Price DECIMAL(10, 2) NOT NULL
);
Which of the following SQL statements alters the "Price" column to allow NULL values?
Consider the following SQL table definition:
CREATE TABLE Customers (
CustomerID INT PRIMARY KEY,
CustomerName VARCHAR(50) NOT NULL,
Email VARCHAR(50) UNIQUE
);
Which of the following SQL statements drops the unique constraint on the "Email" column?
Consider the following SQL table definition:
CREATE TABLE Books (
BookID INT PRIMARY KEY,
BookName VARCHAR(50),
AuthorID INT,
FOREIGN KEY (AuthorID) REFERENCES Authors(AuthorID) ON DELETE CASCADE
);
Which of the following constraints is specified in the table definition?
Consider the following SQL table definition:
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
EmployeeName VARCHAR(50),
ManagerID INT,
CONSTRAINT FK_Employees_Manager FOREIGN KEY (ManagerID) REFERENCES Employees(EmployeeID)
);
Which type of relationship is represented by the foreign key constraint in the "Employees" table?
Consider the following SQL table definition:
CREATE TABLE Products (
ProductID INT PRIMARY KEY,
ProductName VARCHAR(50),
CategoryID INT,
CONSTRAINT CHK_Products_Category CHECK (CategoryID IN (1, 2, 3))
);
Which of the following constraints restricts the possible values of the "CategoryID" column to a specific set of values?
Consider the following SQL table definition:
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
EmployeeName VARCHAR(50),
DepartmentID INT
);
Which of the following SQL statements adds a foreign key constraint to the "DepartmentID" column referencing the "Departments" table, where the "DepartmentID" column in the "Departments" table is defined as UNIQUE?
Consider the following SQL table definition:
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
StudentName VARCHAR(50),
Age INT
);
Which of the following SQL statements adds a unique constraint to the "StudentName" column?