You are on page 1of 2

1.

Designing flow chart


Start
Use the variable Result as type float
Display “Input the Result”
Accept the Result
If (Result>=50)
Display “Satisfactory”
Else
Display “Not satisfactory”
Stop
2. Draw Entity Relationship Diagram (ERD)
A. Suppose that a DEPENDENT entity is identified by the dependent’s first name and
birhtdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a
weak entity type with EMPLOYEE as its identifying entity type via the identifying
relationship type DEPENDENT_OF
B. The company is organized into departments. Each department has a unique name and a
unique number with several locations.
A department controls a number of projects, each of which has a unique name, unique
number and a single location.
We store each employees name, social security number, address, and salary. An
employee is assigned to one department but may work on several projects, which are not
necessarily controlled by the same departments.
We want to keep track of the dependents of each employee for insurance purposes. We
keep each dependent’s name, age and relationship to the employee.
3. Consider the following relational schemas create the following tables and insert values.
EMPLOYEE (EMPLOYEE_NAME, STREET, CITY)
WORKS (EMPLOYEE_NAME, COMPANYNAME, SALARY)
COMPANY (COMPANY_NAME, CITY)
4. Give an expression in SQL for each of queries below:
(i) Find the names of all employees who work for first Bank Corporation.
(ii) Find the names and company names of all employees sorted in ascending order of company name
and descending order of employee names of that company.
(iii) Change the city of First Bank Corporation to ‘New Delhi’
5. A. Create database named as PROJECT using SQL server
B. Create the following tables in PROJECT database using the information given
CUSTOMER

Cust_ID FirstName LastName City IndustryType


SALESPERSON

SP_ID Name Gender Salary


ORDERS

Order_ID Order_Date SP_ID Cust_ID Amount


C. Set Cust_ID,SP_ID and Order_ID for CUSTOMER,SALESPERSON and ORDERS as a primary
key respectively.
D. Add a new column named “Age” as type into SALESPERSON table.
Consider the following relational schemas:
EMPLOYEE (EMPLOYEE_NAME, STREET, CITY)
WORKS (EMPLOYEE_NAME, COMPANYNAME, SALARY)
COMPANY (COMPANY_NAME, CITY)
Ans: CREATE TABLE EMPLOYEE (
EMPLOYEE_NAME VARCHAR2(20) PRIMARY KEY,
STREET VARCHAR2(20),
CITY VARCHAR2(15));
CREATE TABLE COMPANY
( COMPANY_NAME VARCHAR2(50) PRIMARY KEY,
CITY VARCHAR2(15));
CREATE TABLE WORKS
( EMPLOYEE_NAME VARCHAR2(20) REFERENCES EMPLOYEE(EMPLOYEE_NAME,
COMPANYNAME VARCHAR2(50) REFERENCES COMPANY(COMPANY_NAME, SALARY
NUMBER(6), CONSTRAINT WORKS_PK PRIMARY KEY(EMPLOYEE_NAME,
COMPANY_NAME));
Give an expression in SQL for each of queries below:
(i) Find the names of all employees who work for first Bank Corporation.
(ii) Find the names and company names of all employees sorted in ascending order of company name and
descending order of employee names of that company.
(iii) Change the city of First Bank Corporation to ‘New Delhi’
Ans:
(i) SELECT EMPLOYEE_NAME FROM WORKS WHERE COMPANYNAME = ‘First Bank
Corporation’;
(ii) SELECT EMPLOYEE_NAME, COMPANYNAME FROM WORKS ORDER BY
COMPANYNAME, EMPLOYEE_NAME DESC;
(iii) UPDATE COMPANY SET CITY = ‘New Delhi’ WHERE COMPANY_NAME = ‘First Bank
Corporation’;

You might also like