MySQL (CBSE Class XI & XII IP)

Create table – 

(With INTEGRITY CONSTRAINTS)

 CREATE TABLE Students

 (

    S_ID integer PRIMARY KEY,

    NAME char(30) NOT NULL,

    GENDER enum(‘M’, ‘F’, ‘O’),

    SUBJECT enum(‘MATH’, ‘COMMERCE’, ‘BIOLOGY’ ,’ART’),

    CLASS char(4),

    SECTION enum(‘A’, ‘B’, ‘C’, ‘Z’),

    BIRTH_DATE date,

    School_Name varchar(40) DEFAULT ‘KV HARDA’,

    CHECK (ID>1000)

 );

Insert Data in this table – 

(Note that String or Text or Date are always insert with using single quotes 

and numbers like integer, float etc enter without quotes

     INSERT INTO Students

      (S_ID, NAME, GENDER, SUBJECT, CLASS, SECTION, BIRTH_DATE,  School_Name) 

       VLAUES

       (1001, ‘Bobby’, ‘M’, ‘COMPUTER’, ‘XII’, ‘Z’, ‘1987-01-27’, ‘BHOPAL’ ), 

       (1002, ‘SUNNY’, ‘M’, ‘COMPUTER’, ‘XI’, ‘A’, ‘1986-04-11’, ‘BANGLORE’ ),

       (1003, ‘AYUSH’, ‘M’, ‘MATH’, ‘XI’, ‘A’, ‘2000-10-09’, ‘KV HARDA’ ),

       (1004, ‘AMIT’, ‘M’, ‘COMMERCE’, ‘XII’, ‘B’, ‘2000-09-21’,  ‘KV HARDA’  ),

       (1005, ‘VISHAL’, ‘M’, ‘COMMERCE‘, ‘XII’, ‘B’, ‘2001-08-23’,  ‘KV HARDA’ ),

       (1006, ‘RASHMI’, ‘F’, ‘MATH’, ‘XII’, ‘A’, ‘2000-01-06’,  ‘KV HARDA’ ),

       (1007, ‘Bobby’, ‘M’, ‘ART’, ‘XII’, ‘Z’, ‘1986-01-31’, ‘HARDA’ ),

       (1008, ‘TAPTI’, ‘F’, ‘COMMERCE‘, ‘XII’, ‘B’, ‘2000-09-12’, ‘KV HARDA’  ),

       (1009, ‘ADITI’, ‘F’, ‘MATH’, ‘XII’, ‘A’, ‘2000-04-06’, ‘KV HARDA’ ),

       (1010, ‘DEVENDRA’, ‘M’, ‘COMMERCE‘, ‘XII’, ‘B’, ‘2000-07-15’, ‘KV HARDA’  ),

       (1011, ‘HARDIK’, ‘M’, ‘COMMERCE‘, ‘XII’, ‘B’, ‘2000-05-18’, ‘KV HARDA’ ),

       (1012, ‘UDDHAV’, ‘M’, ‘COMMERCE‘, ‘XII’, ‘B’, ‘2000-12-10’, ‘KV HARDA’ ),

       (1013, ‘AASHI’, ‘F’, ‘MATH’, ‘XII’, ‘A’, ‘2000-10-19’, ‘KV HARDA’  ),

       (1014, ‘PRANJALI’, ‘F’, ‘MATH’, ‘XII’, ‘A’, ‘2001-10-18’, ‘KV HARDA’  ),

       (1015, ‘AARTI’, ‘F’, ‘BIOLOGY’, ‘XII’, ‘C’, ‘2001-05-19’, ‘KV HARDA’  ),

       (1016, ‘LEKHA’, ‘F’, ‘BIOLOGY’, ‘XI’, ‘C’, ‘2003-01-21’, ‘KV HARDA’ )  ; 

Students

S_IDNAME GENDERSUBJECTCLASSSECTIONBIRTH_DATESchool_Name
1001BOBBYMCOMPUTERXIIZ1987-01-27BHOPAL
1002SUNNYMCOMPUTERXIA1986-04-11BANGLORE
1003AYUSHMMATHXIA2000-10-09KV HARDA
1004AMITMCOMMERCEXIIB2000-09-21KV HARDA
1005VISHALMCOMMERCEXIIB2001-08-23KV HARDA
1006RASHMIFMATHXIIA2000-01-06KV HARDA
1007BOBBY SONIMARTXIIZ1986-01-31HARDA
1008TAPTIFCOMMERCEXIIB2000-09-12KV HARDA
1009ADITIFMATHXIIA2000-04-06KV HARDA
1010DEVENDRAMCOMMERCEXIIB2000-07-15KV HARDA
1011HARDIKMCOMMERCEXIIB2000-05-18KV HARDA
1012UDDHAVMCOMMERCEXIIB2001-12-10KV HARDA
1013AASHIFMATHXIIA2000-10-19KV HARDA
1014PRANJALIFMATHXIIA2001-10-18KV HARDA
1015AARTIFBIOLOGYXIIC2001-05-19KV HARDA
1016LEKHAFBIOLOGYXIC2003-01-21KV HARDA

2 thoughts on “MySQL Create Table

Leave a Reply

Your email address will not be published. Required fields are marked *