SQL Lab1: Create a Database Table for DayCare



1: Create a Database Table for DayCare

sol : 

      CREATE TABLE dc_kids (
kid_id INT NOT NULL AUTO_INCREMENT,
kid_fname VARCHAR(30) NOT NULL,
        kid_lname VARCHAR(30) NOT NULL,
kid_gender CHAR(1) NOT NULL,
        kid_age SMALLINT UNSIGNED NOT NULL,
        kid_address TEXT NOT NULL,
kid_dob DATETIME NOT NULL,
        kid_father VARCHAR(30) NOT NULL,
        kid_mother VARCHAR(30) NOT NULL,
kid_emgcontact VARCHAR(15) NOT NULL,
PRIMARY KEY (kid_id)
 )
 ENGINE=INNODB;

// Inserting data to Table...

INSERT INTO dc_kids (kid_fname, kid_lname, kid_gender, kid_age, kid_address, kid_dob, kid_father, kid_mother, kid_emgcontact)
VALUES ('Deep', 'Bhati', 'M', '3', '21st Jump Street', '1996-12-06 05:18:01', 'Mahesh', 'Megha', '987654321'),
    ('Scarlett', 'Johansson', 'F', '4', '21B Baker Street', '1992-11-06 06:19:02', 'Bruce', 'Amanda', '897654321'),
    ('Ramesh', 'Sharma', 'M', '5', '22st Jump Street', '1990-10-05 07:20:03', 'Mukesh', 'Aba', '887654321'),
    ('Suresh', 'Varma', 'M', '6', '23st Jump Street', '1991-09-05 08:21:04', 'Ramesh', 'Aruna', '877654321'),
    ('Mukesh', 'Raina', 'M', '7', '24st Jump Street', '1993-08-04 09:22:05', 'Suresh', 'Lata', '867654321'),
    ('Rajesh', 'Singh', 'M', '8', '25st Jump Street', '1994-07-04 04:23:06', 'Deep', 'Ashu', '857654321'),
    ('Tom', 'Cook', 'M', '9', '26st Jump Street', '1995-06-03 03:24:07', 'Jerry', 'Poonam', '847654321'),
    ('Harry', 'Potter', 'M', '10', '27st Jump Street', '1989-05-03 02:25:08', 'Huge', 'may', '837654321'),
    ('Huge', 'Jackman', 'M', '11', '28st Jump Street', '1988-04-03 01:26:09', 'Logan', 'juily', '827654321'),
('Mukesh', 'Raina', 'M', '7', '24st Jump Street', '1993-08-04 09:22:05', 'Suresh', 'Lata', '867654321'),
    ('Rajesh', 'Singh', 'M', '8', '25st Jump Street', '1994-07-04 04:23:06', 'Deep', 'Ashu', '857654321'),
    ('Tom', 'Cook', 'M', '9', '26st Jump Street', '1995-06-03 03:24:07', 'Jerry', 'Poonam', '847654321'),
    ('Harry', 'Potter', 'M', '10', '27st Jump Street', '1989-05-03 02:25:08', 'Huge', 'may', '837654321'),
    ('Huge', 'Jackman', 'M', '11', '28st Jump Street', '1988-04-03 01:26:09', 'Logan', 'juily', '827654321'),
    ('Robert', 'Drowny', 'M', '12', '29st Jump Street', '1987-03-02 07:27:07', 'Tony', 'pepper', '817654321');



2: Create Database Table for an Event Ticket

sol :

  CREATE TABLE ticket (
ticket_id INT NOT NULL AUTO_INCREMENT,
customer_id INT NOT NULL,
        order_id INT NOT NULL,
        status_id INT NOT NULL,
        date_purchased DATETIME NOT NULL,
seatzonenumber INT NOT NULL,
        seatzonename VARCHAR(30),
        ticketname VARCHAR(30),
        price DECIMAL NOT NULL,
        barcode VARCHAR(12) NOT NULL,
PRIMARY KEY (ticket_id)
 );

// Inserting data to Table...


INSERT INTO ticket (customer_id, order_id, status_id, date_purchased, seatzonenumber, seatzonename, ticketname, price, barcode)
VALUES ('1', '11', '21', '1996-12-06 05:18:01', '31', 'A', 'Silver', '10', '012345678910'),
    ('2', '12', '22', '1992-11-06 06:19:02', '32', 'B', 'Gold', '20', '123456789101'),
    ('3', '13', '23', '1990-10-05 07:20:03', '33', 'C', 'Platinum', '30', '234567891011'),
    ('4', '14', '24', '1991-09-05 08:21:04', '34', NULL, 'Bronze', '40', '345678910111'),
    ('5', '15', '25', '1993-08-04 09:22:05', '35', 'E', 'Premium', '50', '456789101112'),
    ('6', '16', '26', '1994-07-04 04:23:06', '36', 'F', 'Vip', '60', '567891011121'),
    ('7', '17', '27', '1995-06-03 03:24:07', '37', 'G', 'VVip', '70', '678910111213'),
    ('8', '18', '28', '1989-05-03 02:25:08', '38', 'H', 'Special', '80', '789101112131'),
    ('9', '19', '29', '1988-04-03 01:26:09', '39', 'I', NULL, '5', '910111213141'),
('5', '15', '25', '1993-08-04 09:22:05', '35', 'E', 'Premium', '50', '456789101112'),
    ('6', '16', '26', '1994-07-04 04:23:06', '36', 'F', 'Vip', '60', '567891011121'),
    ('7', '17', '27', '1995-06-03 03:24:07', '37', 'G', 'VVip', '70', '678910111213'),
    ('8', '18', '28', '1989-05-03 02:25:08', '38', 'H', 'Special', '80', '789101112131'),
    ('9', '19', '29', '1988-04-03 01:26:09', '39', 'I', NULL, '5', '910111213141'),
    ('10', '20', '30', '1987-03-02 07:27:07', '40', 'J', NULL, '15', '101112131415');


Comments

Popular posts from this blog

5th sem OOPJ Write an interactive program to print a diamond shape. For example, if user enters the number 3, the diamond will be as follows:

SQL Lab 3