0% found this document useful (0 votes)
4 views

DBMS lab 1

The document outlines a series of tasks related to database management, specifically focusing on SQL queries for displaying and manipulating data from EMPLOYEES and DEPARTMENTS tables. It includes instructions for creating queries, displaying table structures, identifying coding errors, and solving SQL problems on LeetCode. Each task is clearly numbered and provides specific requirements for the queries to be executed.

Uploaded by

ghauri4600302
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

DBMS lab 1

The document outlines a series of tasks related to database management, specifically focusing on SQL queries for displaying and manipulating data from EMPLOYEES and DEPARTMENTS tables. It includes instructions for creating queries, displaying table structures, identifying coding errors, and solving SQL problems on LeetCode. Each task is clearly numbered and provides specific requirements for the queries to be executed.

Uploaded by

ghauri4600302
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CT-067

Khansa Khan Ghauri

DBMS LAB 01
1. Display the last name concatenated with the job ID, separated by a comma and space, and name
the column Employee and Title.

2. Create a query to display all the data from the EMPLOYEES table. Separate each column by a
comma. Name the column THE_OUTPUT.

3. Show the structure of the DEPARTMENTS table. Select all data from the table.

Database Management System


CT-067
Khansa Khan Ghauri

4. Show the structure of the EMPLOYEES table. Create a query to display the last name, job code,
hire date, and employee number for each employee, with employee number appearing first.

Database Management System


CT-067
Khansa Khan Ghauri

5. Create a query to display unique job codes from the EMPLOYEES table.

Database Management System


CT-067
Khansa Khan Ghauri

6. There are four coding errors in this statement. Can you identify them?
SELECT employee_id, last_name sal x 12 ANNUAL SALARY FROM employees;

 Missing AS keyword

 Column name should be ‘salary’ not ‘sal’

 Multiplication syntax should be written as ‘salary * 12’

 Comma is missing between last_name and sal x 12

Database Management System


CT-067
Khansa Khan Ghauri

7. Make account on leetcode, head to https://leetcode.com/studyplan/top-sql-50/ and solve 5


questions in the select tag. The questions involve usage of “Where” clause.

 1757: Recyclable And Low Fat Products

 584: Find Customer Referee

 595: Big countries

 1148: Article Views I

Database Management System


CT-067
Khansa Khan Ghauri

 1683: Invalid Tweets

Database Management System

You might also like