0% found this document useful (0 votes)
40 views2 pages

Employee Department: ST RD TH

This document contains an exam for a database course consisting of 4 multiple choice questions. The first question asks students to connect two tables and write an SQL statement to print employee names and department names. The second asks to print names, salaries, average department salaries, and the difference between an employee's salary and the department average. The third asks to calculate net sales from two tables listing purchases and sales. The fourth asks to print subjects and their associated branches from a table.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Employee Department: ST RD TH

This document contains an exam for a database course consisting of 4 multiple choice questions. The first question asks students to connect two tables and write an SQL statement to print employee names and department names. The second asks to print names, salaries, average department salaries, and the difference between an employee's salary and the department average. The third asks to calculate net sales from two tables listing purchases and sales. The fourth asks to print subjects and their associated branches from a table.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

4102

01:

Q1) for the shown tables required that:


Employee

Department

ID
1
2

Name
Ahmad
Aly

Salary
1200
1500

3
4

Samy
Hany

2000
1750

Num

Name

Location

IT

1st

Financial

3rd

Sales

4th

1- Connect between two tables (add foreign key as you need )


2- Write a SQL statement to print name of employee and name of department
Example:
Ahmad IT
Aly

Sales

Samy

Sales

Hany

IT

Q2) Write a SQL Statement to Print:

Name

Department Salary

Name, Salary, Average of Department,

Ahmad

Engineering

1100

Aly

Engineering

2200

Mona

Engineering

600

Hany

IT

1000

Ramy

IT

2000

Samy

IT

300

Difference between Salary and Average of


Department




4102



01:

Q3) Write a SQL Statement to Calculate Net Sales:


ID

Quantity

ID

Quantity

70

50

200

110

90

90

350

300

40

36

Purchases

Sales

Q4) Write a SQL Statement to print:


Subject, Branch
Examples:

Database

Programming Skills

Web Development

Programming Skills

SQL Server

Database

ID
1
2
3
4
5
6

Oracle

Database

PHP

Web Development

HTML

Web Development

Programming Skills Null

Subject
Programming Skills
Database
Web Development
Sql Server
Oracle
PHP

BranchID
Null
1
1
2
2
3

HTML

You might also like