MySQL - Enum and Set, Study notes of Computer Engineering and Programming

MySQL - Enum and Set Used when inserting selected data inside the Enum or Set Parenthesis

Typology: Study notes

2021/2022

Available from 02/16/2022

jean-undang
jean-undang 🇵🇭

11 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ENUM
- Accepts only certain / declared values inside the ENUM parenthesis.
- Below example will accept only values that are Low, Medium, and High.
- SQL will map the values inside Enum to 1,2,3...therefore arrangement is important.
Page 1
MySQL
ENUM and SET
Created By: mju2022 | Feb 16,2022 | 7:07 PM | LNC
pf3
pf4
pf5

Partial preview of the text

Download MySQL - Enum and Set and more Study notes Computer Engineering and Programming in PDF only on Docsity!

ENUM

  • Accepts only certain / declared values inside the ENUM parenthesis.
  • Below example will accept only values that are Low, Medium, and High.
  • SQL will map the values inside Enum to 1,2,3...therefore arrangement is important.

MySQL

ENUM and SET

SET

  • Selects value inside the SET parenthesis.
  • Data inserted are bitmapped.

SAMPLE CODES FOR SETS

CREATE A TABLE TICKETS

CREATE TABLE Tickets ( ID INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, Action_Owner SET('John','Peter','Lloyd') NOT NULL ); INSERT VALUES ONTO THE TABLE INSERT INTO Tickets VALUES(null,'Bug','John'); INSERT INTO Tickets VALUES(null,'Tableau Error','Peter'); INSERT INTO Tickets VALUES(null,'Excel Error','Lloyd'); INSERT INTO Tickets VALUES(null,'No Internet',1); INSERT INTO Tickets VALUES(null,'Inaccessible Site',2); INSERT INTO Tickets VALUES(null,'Automatic Shutdown',3); INSERT INTO Tickets VALUES(null,'No Internet',4); INSERT INTO Tickets VALUES(null,'Inaccessible Site',5); INSERT INTO Tickets VALUES(null,'Automatic Shutdown',6); INSERT INTO Tickets VALUES(null,'Automatic Shutdown',7); SELECT * FROM Tickets;