• Cyberian's Gold

    Database Programming Using Oracle 11g – CS405
    

    Semester: Fall 2019
    Lectures Covered : 01-07
    Total Marks: 20
    Due Date: 14/11/2019

    Objectives:
    Students will be able to learn:
    • Entity Relationship Diagram
    • Structured Query Language
    • How to write SQL Statement
    Instructions:
    Please read the following instructions carefully before submitting assignment:
    It should be clear that your assignment will not get any credit if:

     The assignment is submitted after due date.
     The assignment is submitted via email.
     The assignment is copied from Internet or from any other student.
     The submitted assignment does not open or file is corrupt.
     It is in some format other than .doc/docx.

    Note: All types of plagiarism are strictly prohibited.

    For any query about the assignment, contact at

    Question no 1
    You are required to draw Entity Relationship Diagram of the following scenario to show how you would track this information. Show entity names, primary keys, attributes for each entity, relationships between the entities and cardinality.
    Scenario
    “A shipping company named ABC shippers keeps up-to-date information upon the processing and current location of each shipped item. For record keeping, following product information is stored: product name, product ID and quantity. Products are made up of many components and each component can be supplied by one or more suppliers. The following component information is stored in databases for record keeping: component ID, name, description, suppliers, and products in which they are used.”
    Keep the following assumptions in mind while drawing ERD
    I. A supplier can exist without providing components.
    II. A component does not have to be associated with a supplier.
    III. A component does not have to be associated with a product. Not all components are used in products.
    IV. A product cannot exist without components.
    Question no 2
    Consider the following table and its attributes:
    Employee (emp_id, emp_name, designation, phone_no, address, joining_date, salary, department)

    You are required to use this table to write SQL statements for the following cases:
    a) Display the name and annual salary of all employees.
    b) Display the name of all employees whose name is at least 4 characters long.
    c) Display the name and department of the employees who earns the maximum salary.
    d) Display data for all employees who earn between 10000 and 20000.
    e) Count no. of employees working in each department.

  • Cyberian's Gold

    100% Solved:
    Solution Q. 1

    30141ff1-0713-4331-947a-b494f3d23d08-image.png

    Solution Q. 2

    1. Select emp_name, sal*12 Annual Salary from Employee;
    2. Select emp_name from Employee where length(ename) >= 4;
    3. Select emp_name, department from Employee where salary = (Select MAX(salary) from Employee);
    4. Select * from Employee where Salary BETWEEN 10000 AND 20000;
    5. Select Department, COUNT (*) Total Employees from employee;
  • Cyberian's Gold

    @zareen said in CS405 Assignment 1 Solution and Discussion:

    e3e13fed-5997-4fb9-8c4e-eb15cf0493a5-image.png

    Create an ERD for a car dealership. The dealership sells both new and used cars, and it operates a service facility (see Figure B.2). Base your design on the following business rules:

    A salesperson may sell many cars, but each car is sold by only one salesperson.
    A customer may buy many cars, but each car is bought by only one customer.
    A salesperson writes a single invoice for each car he or she sells.
    A customer gets an invoice for each car he or she buys.
    A customer may come in just to have his or her car serviced; that is, a customer need not buy a car to be classified as a customer.
    When a customer takes one or more cars in for repair or service, one service ticket is written for each car.
    The car dealership maintains a service history for each of the cars serviced. The service  records are referenced by the car’s serial number.
    A car brought in for service can be worked on by many mechanics, and each mechanic may work on many cars.
    A car that is serviced may or may not need parts (e.g., adjusting a carburetor or cleaning a fuel injector nozzle does not require providing new parts).
    

    ERD Answer

  • Cyberian's Gold

    @zareen said in CS405 Assignment 1 Solution and Discussion:

    128ec1d5-b72d-4dbe-89f4-ffea9d7225c5-image.png

    ERD Answer

    Component(CompID, CompName, Description) PK=CompID

    Product(ProdID, ProdName, QtyOnHand) PK=ProdID

    Supplier(SuppID, SuppName) PK = SuppID

    CompSupp(CompID, SuppID) PK = CompID, SuppID

    Build(CompID, ProdID, QtyOfComp) PK= CompID, ProdID

  • Cyberian's Gold

    128ec1d5-b72d-4dbe-89f4-ffea9d7225c5-image.png

  • Cyberian's Gold

    e3e13fed-5997-4fb9-8c4e-eb15cf0493a5-image.png

  • Cyberian's Gold

    100% Solved:
    Solution Q. 1

    30141ff1-0713-4331-947a-b494f3d23d08-image.png

    Solution Q. 2

    1. Select emp_name, sal*12 Annual Salary from Employee;
    2. Select emp_name from Employee where length(ename) >= 4;
    3. Select emp_name, department from Employee where salary = (Select MAX(salary) from Employee);
    4. Select * from Employee where Salary BETWEEN 10000 AND 20000;
    5. Select Department, COUNT (*) Total Employees from employee;
Insaf Sehat Card Live Cricket Streaming
Quiz 100% Result Quiz 100% Result
| |