CREATE TABLE Students (
student_id INT UNIQUE,
student_name VARCHAR(50)
);
ALTER TABLE Students ADD UNIQUE (student_id);
CREATE UNIQUE INDEX idx_student_id ON Students (student_id);
CREATE TABLE Orders (
order_id INT,
customer_id INT,
UNIQUE (order_id, customer_id)
);
CREATE TABLE Employees (
employee_id INT UNIQUE NOT NULL,
employee_name VARCHAR(50) NOT NULL
);
INSERT INTO Students (student_id, student_name) VALUES (1, 'Alice') ON DUPLICATE KEY UPDATE student_name = 'Alice';
UPDATE Students SET student_name = 'Bob' WHERE student_id = 1;
CREATE TABLE Orders (
order_id INT UNIQUE,
customer_id INT,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
INSERT INTO Students (student_id, student_name) VALUES (1, 'Alice'), (2, 'Bob') ON DUPLICATE KEY IGNORE;
CREATE TABLE Employees (
employee_id INT UNIQUE,
employee_name VARCHAR(50),
PRIMARY KEY (employee_id)
);