enum in sql server

Solutions on MaxInterview for enum in sql server by the best coders in the world

showing results for - "enum in sql server"
Raphael
12 Apr 2020
1USE WorldofWarcraft;
2
3CREATE TABLE [users]
4(
5   ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
6   username nvarchar(255),
7   password nvarchar(255),
8   mail nvarchar (255),
9   [rank]  nvarchar (255) NOT NULL CHECK ([rank] IN('Fresh meat', 'Intern','Janitor','Lieutenant','Supreme being')) DEFAULT 'Fresh meat'
10);
11
12
Micaela
28 Jan 2020
1Copied CREATE TABLE shirts (
2    name VARCHAR(40),
3    size ENUM('x-small', 'small', 'medium', 'large', 'x-large')
4);
5INSERT INTO shirts (name, size) VALUES ('dress shirt','large'), ('t-shirt','medium'),
6  ('polo shirt','small');
7SELECT name, size FROM shirts WHERE size = 'medium';
8+---------+--------+
9| name    | size   |
10+---------+--------+
11| t-shirt | medium |
12+---------+--------+
13UPDATE shirts SET size = 'small' WHERE size = 'large';
14COMMIT;