A: Commands for the Employee Table ( eID | eName | Designation | Address | Age ) : 69

1. Create a table named 'Employees' for the following entries, using different constraints. Also, use a primary key in the table creation.


CREATE TABLE Employees
  (
     eID         INT NOT NULL PRIMARY KEY,
     eName       VARCHAR(100),
     Designation VARCHAR(100),
     Address     VARCHAR(100),
     Age         INT
  ) ;


2. Insert all the data in the employees table as given above.


INSERT INTO Employees
VALUES      (1001,
             'Rabin',
             'Marketing',
             'Kathmandu',
             27);

INSERT INTO Employees
VALUES      (1002,
             'Shekhar',
             'Sales',
             'Lalitpur',
             32);

INSERT INTO Employees
VALUES      (1003,
             'Raman',
             'Accounting',
             'Lalitpur',
             33);

INSERT INTO Employees
VALUES      (1006,
             'Rashmi',
             'Sales',
             'Kathmandu',
             31);

INSERT INTO Employees
VALUES      (1015,
             'Sushmita',
             'Marketing',
             'Bhaktapur',
             28);

INSERT INTO Employees
VALUES      (1027,
             'Shubham',
             'Marketing',
             'Bhaktapur',
             29);  

 

OR

 


INSERT INTO Employees
VALUES      (1001,
             'Rabin',
             'Marketing',
             'Kathmandu',
             27),
            (1002,
             'Shekhar',
             'Sales',
             'Lalitpur',
             32),
            (1003,
             'Raman',
             'Accounting',
             'Lalitpur',
             33),
            (1006,
             'Rashmi',
             'Sales',
             'Kathmandu',
             31),
            (1015,
             'Sushmita',
             'Marketing',
             'Bhaktapur',
             28),
            (1027,
             'Shubham',
             'Marketing',
             'Bhaktapur',
             29); 

 

3. Select all the entries with the designation 'Marketing'.


SELECT *
FROM   Employees
WHERE  Designation = 'Marketing'; 


4. Select all the entries with the address 'Kathmandu'.


SELECT *
FROM   Employees
WHERE  Address = 'Kathmandu';