50 likes | 193 Views
Seminar 2: Simple SQL Retrievals. Purpose To write simple SQL queries. To retrieve relations in different order. Scenario The Company database contains data about the departments with their employees, as well as for the department projects with the employees working on them.
E N D
Seminar 2: Simple SQL Retrievals • Purpose • To write simple SQL queries. • To retrieve relations in different order. • Scenario • The Company database contains data about the departments with their employees, as well as for the department projects with the employees working on them. • The set of relations in the Company relational schema is provided on the Figure 1. • Data for one particular instance of database Company is provided on Figure 2. • The SQL script for creating relational database with the above test data preloaded is provided in the file Company.sql which you can download from Blackboard. Seminar #3 CM036: Advanced Databases
Company Relational Schema • DEPT: stores data about company departments, including their managers • EMP: stores data about people working in the company • PROJ: stores data about the projects on which the company currently works • ALLOC: stores data about the people allocated to different projects Figure 1 Seminar #3 CM036: Advanced Databases
Database Schema Instance Figure 2 Seminar #3 CM036: Advanced Databases
Tasks for the Seminar • Creating the Company database. • Download Company.sql from Blackboad and save it in a folder on your U drive, e.g., U:\CM0719. • Connect to the Oracle database using SQL*Plus with the following details: UserName: YourWindwsUserId Password: PASSWORD Host: INFORMATICS • Create and Load the Company database e.g., SQL> @U:\CM0719\Company 2. Write the following queries against Company database using Oracle SQL: • Display name and number of each employee. • Display name and salary of each employee in ascending order. • Display details of projects in descending order of deadline. Seminar #3 CM036: Advanced Databases