1. Draw an ER Diagram for the following scenario: A university consists of a number of
departments. Each department offers...
Upcoming SlideShare
Loading in …5

SQL practice questions for beginners


Published on

SQL practice questions for beginners.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

SQL practice questions for beginners

  1. 1. 1. Draw an ER Diagram for the following scenario: A university consists of a number of departments. Each department offers several courses. A number of modules make up each course. Students enrols in a particular course and take modules towards the completion of that course. Each module is taught by a lecturer from the appropriate department, and each lecturer tutors a group of students. 2. Draw an ER Diagram for the following scenario : We want to represent information about products in a database. Each product has a description, a price and a supplier. Suppliers have addresses, phone numbers, and names. Each address is made up of a street address, a city, and a postcode. 3. Draw an ER Diagram for the following scenario : A database will be made to store information about patients in a hospital. On arrival, each patient’s personal details (name, address, and telephone number) are recorded where possible, and they are given an admission number. They are then assigned to a particular ward (Accident and Emergency, Cardiology, Oncology, etc.). In each ward there are a number of doctors and nurses. A patient will be treated by one doctor and several nurses over the course of their stay, and each doctor and nurse may be involved with several patients at any given time. 4. Draw an ER Diagram for the following scenario: The company you work for wants to digitize their time cards. You have been asked to design the database for submitting and approving time cards. Draw the database ER diagram with the following information: A timecard should have hours worked and date submitted Each timecard is associated with exactly one employee Each timecard should have a unique id Each timecard has a status: it is either approved, not approved, or pending Each employee has a unique id Each employee has a name and address. Each employee submits a time card every pay period. i.e. In 1 year, they will submit multiple time cards Each employee either has direct deposit or physical check as their method of payment Each employee is associated with exactly one manager Each manager has a unique id and a name Each manager is in charge of multiple employees Each manager approves time cards for multiple employees 5. There exists a database of people who take measurements of trees in various locations. A person may take measurements of multiple trees, and each tree may be measured multiple times throughout a number of days. For each and every tree we need to collect information about to what species does it belong to, what are the latitude and longitude of the tree. We also need to maintain an identification number for each and every tree. Whoever the person taking the measurements of the tree , that persons name,unique identification number,address and role need to be maintained. Whatever the measurements taken need to maintained separately with the details of what the diameter and height of the tree , when exactly the measurement has been taken. For each and measurement taken we have to maintain a record. We also need to correlate with who is the person who has taken the measurement. Depict an ER diagram for the above scenario.