Introduction to Database Systems (SWE-209L) SSUET/QR/114
Lab # 3: Creating and Altering Tables
LAB # 3
CREATING AND ALTERING TABLES
OBJECTIVE: Creating and altering tables.
LAB TASKS:
1. Write a SQL statement to create a table named jobs including columns job_id,
job_title, min_salary, max_salary and check whether the max_salary amount
exceeding the upper limit 25000.
QUERY:
OUTPUT:
If I will enter max_sal greater than 25000 it will give error and do not run the query
because we have set the condition in the query that check (max_sal <= 25000).
This study source SYED
was downloaded
TAYYAB by 100000820744938 from [Link] on 04-04-2022 [Link] GMT -05:00
RAZA ZAIDI (2020-SE-272) 1
[Link]
Introduction to Database Systems (SWE-209L) SSUET/QR/114
Lab # 3: Creating and Altering Tables
2. Write a SQL statement to create a table named jobs including columns job_id,
job_title, min_salary and max_salary, and make sure that, the default value for
job_title is blank and min_salary is 10000 and max_salary is NULL will be entered
automatically at the time of insertion if no value assigned for the specified columns.
QUERY:
OUTPUT:
3. Write a SQL statement to create a table employees including columns employee_id,
first_name, last_name, email, phone_number hire_date, job_id, salary, commission,
manager_id and department_id and make sure that, the employee_id column does not contain
any duplicate value at the time of insertion and the foreign key columns combined by
department_id and manager_id columns contain only those unique combination values, which
combinations are exists in the departments table. Assume the structure of departments table
below.
This study source SYED
was downloaded
TAYYAB by 100000820744938 from [Link] on 04-04-2022 [Link] GMT -05:00
RAZA ZAIDI (2020-SE-272) 2
[Link]
Introduction to Database Systems (SWE-209L) SSUET/QR/114
Lab # 3: Creating and Altering Tables
QUERY:
OUTPUT:
This study source SYED
was downloaded
TAYYAB by 100000820744938 from [Link] on 04-04-2022 [Link] GMT -05:00
RAZA ZAIDI (2020-SE-272) 3
[Link]
Introduction to Database Systems (SWE-209L) SSUET/QR/114
Lab # 3: Creating and Altering Tables
4. Write a SQL statement to change salary of employee to 8000 whose ID is 105, if the existing
salary is less than 5000.
QUERY:
OUTPUT:
This study source SYED
was downloaded
TAYYAB by 100000820744938 from [Link] on 04-04-2022 [Link] GMT -05:00
RAZA ZAIDI (2020-SE-272) 4
[Link]
Powered by TCPDF ([Link])