This document contains the database schema and data for an Internet Cafe Users database project. It includes tables for Internet Cafes, Users, Gadgets/Devices, Bookings, Suppliers, Technicians, and Repairs. The document lists the table structures with column names and data types. It identifies the primary and foreign keys for each table. Entity relationship diagrams are included to show the relationships between tables. Sample data is provided for some tables in the form of INSERT statements. The project involves creating the tables, populating them with data, and writing queries to retrieve and manipulate the data.
Step by step guide to formatting the SAP BPC EPM SheetCloneskills
EPM Formatting Sheet can be used to format your Reports and Input Forms. There are
various options for formatting.
You can do simple formatting, lock the cells that are not input ready, use the format by
property using multiple criteria, or use a new cell-based formula delivered with the EPM
add-in to override the data range formatting.
Dynamic formatting is defined in a dedicated sheet. Formats can be applied to levels of a
hierarchy, types of members, odd/even rows, or columns and page axis dimensions. Since
the EPM Formatting Sheet is an excel sheet, it can be copied and changed to be applied to
other reports, worksheets.
There are various sections on the EPM Formatting Sheet
• Hierarchy Level Formatting
• Dimension Member/Property Formatting
• Row and Column Banding
• Page Axis Formatting
SAP BPC on HANA Environment Export Import Implementation Guide v9Jothi Periasamy
This document provides steps to export and import a BPC environment between SAP HANA systems. It outlines logging into SAP HANA, exporting the environment by entering commands and selecting options, importing the environment using a similar process, and verifying the imported environment by logging into BPC. The document is authored by Dipti Suchak, Yogendra Vaithilingam and Jothi Periasamy from CloneSkills, Inc. and provides guidance on migrating a BPC environment across SAP HANA systems.
The document provides a template for students to write a business letter to a candy company about a school project. The letter is meant to introduce themselves and their project, state something positive about the product, explain the project and their research, ask a question to the company supported by their data, and thank the company for their time. The majority of the template includes blank lines for the students to fill in the details of their specific letter.
This character sheet is for Nićifor Vulee and contains stats and details about his abilities, skills, advantages, disadvantages, and equipment. He has a point total of 150 and is 54 years old. His top skills are Fast-Talk with a level of 18 and Public Speaking at 15. Among his advantages are Charisma (+10) and Clerical Investment (+5) while his disadvantages include Fat (-3) and Cowardice (-10). The sheet provides an overview of his proficiencies and equipment for roleplaying games.
The document provides an implementation plan for a database to support the Refugio Web System project. It includes an entity relationship diagram, logical database model, data dictionary defining the database tables and columns, functional dependency graph, and SQL script to create the database along with sample data. The plan was prepared by KMDC2 and contains details needed to set up the backend database for the Refugio Web System.
Obama read my lips -obama fraudgate (tamil)VogelDenise
This document discusses the connections between various political and business figures. It mentions that the law firm Baker Donelson represented the Carlyle Group and had connections to the Bushes, Clinton administration officials, and Obama administration officials. It also references several scandals and investigations related to individuals such as Bernie Madoff and JP Morgan Chase. Overall, the document suggests political connections and potential improprieties between the law firm, investment firms, and public officials.
This document contains summaries of various SQL concepts and examples covered on different dates, including creating tables, adding and dropping columns, updating and deleting rows, and using functions like NVL. The summaries cover topics like data definition language (DDL) and data manipulation language (DML) statements, creating and modifying tables, and using SQL functions. Examples are provided of creating multiple tables with different column definitions and inserting, selecting, and updating data.
Step by step guide to formatting the SAP BPC EPM SheetCloneskills
EPM Formatting Sheet can be used to format your Reports and Input Forms. There are
various options for formatting.
You can do simple formatting, lock the cells that are not input ready, use the format by
property using multiple criteria, or use a new cell-based formula delivered with the EPM
add-in to override the data range formatting.
Dynamic formatting is defined in a dedicated sheet. Formats can be applied to levels of a
hierarchy, types of members, odd/even rows, or columns and page axis dimensions. Since
the EPM Formatting Sheet is an excel sheet, it can be copied and changed to be applied to
other reports, worksheets.
There are various sections on the EPM Formatting Sheet
• Hierarchy Level Formatting
• Dimension Member/Property Formatting
• Row and Column Banding
• Page Axis Formatting
SAP BPC on HANA Environment Export Import Implementation Guide v9Jothi Periasamy
This document provides steps to export and import a BPC environment between SAP HANA systems. It outlines logging into SAP HANA, exporting the environment by entering commands and selecting options, importing the environment using a similar process, and verifying the imported environment by logging into BPC. The document is authored by Dipti Suchak, Yogendra Vaithilingam and Jothi Periasamy from CloneSkills, Inc. and provides guidance on migrating a BPC environment across SAP HANA systems.
The document provides a template for students to write a business letter to a candy company about a school project. The letter is meant to introduce themselves and their project, state something positive about the product, explain the project and their research, ask a question to the company supported by their data, and thank the company for their time. The majority of the template includes blank lines for the students to fill in the details of their specific letter.
This character sheet is for Nićifor Vulee and contains stats and details about his abilities, skills, advantages, disadvantages, and equipment. He has a point total of 150 and is 54 years old. His top skills are Fast-Talk with a level of 18 and Public Speaking at 15. Among his advantages are Charisma (+10) and Clerical Investment (+5) while his disadvantages include Fat (-3) and Cowardice (-10). The sheet provides an overview of his proficiencies and equipment for roleplaying games.
The document provides an implementation plan for a database to support the Refugio Web System project. It includes an entity relationship diagram, logical database model, data dictionary defining the database tables and columns, functional dependency graph, and SQL script to create the database along with sample data. The plan was prepared by KMDC2 and contains details needed to set up the backend database for the Refugio Web System.
Obama read my lips -obama fraudgate (tamil)VogelDenise
This document discusses the connections between various political and business figures. It mentions that the law firm Baker Donelson represented the Carlyle Group and had connections to the Bushes, Clinton administration officials, and Obama administration officials. It also references several scandals and investigations related to individuals such as Bernie Madoff and JP Morgan Chase. Overall, the document suggests political connections and potential improprieties between the law firm, investment firms, and public officials.
This document contains summaries of various SQL concepts and examples covered on different dates, including creating tables, adding and dropping columns, updating and deleting rows, and using functions like NVL. The summaries cover topics like data definition language (DDL) and data manipulation language (DML) statements, creating and modifying tables, and using SQL functions. Examples are provided of creating multiple tables with different column definitions and inserting, selecting, and updating data.
This document contains details about creating and populating a database to store information about college society balls. It includes the entity relationship diagram and tables to store data on colleges, societies, hotels, disc jockeys, security firms, and balls. SQL statements are provided to create the tables, define primary keys and foreign keys, and insert sample data records.
This document describes the creation and testing of databases using various database management systems including Sybase ASE 15 and 16, Microsoft SQL Server 2012 and 2008 R2, and Microsoft Access 2010. It covers topics such as database creation, table design, indexing, triggers, population, verification, and manipulation of data. For each database system, details are provided about setting up the database structure, populating tables with data, running tests and queries, and addressing any issues that came up.
The project involves creating an indoor map of rooms at the Carnegie Library. It includes creating tables to store information about rooms, resources, users, and bookings. Relationships between tables are defined in an ER diagram. Sample data is inserted using SQL scripts. Forms and reports allow users and administrators to view and query data about rooms, bookings, and resources. A trigger is created to automatically update the capacity field in the rooms table when the number of chairs or tables changes. The app will help users like faculty and students locate rooms and resources within the library.
Rich relational data from thin air john stinsonJohn Stinson
The document discusses techniques for simulating relational data using a star schema model with dimension tables for devices, pages, users, and a fact table for page hits. It describes generating random user profiles based on name, gender, region distributions and simulating page hit data with timestamps based on hourly usage patterns over multiple years and devices.
This document describes a desktop application developed in Java that manages student records for a school of social sciences. It allows administrators to add, update, and view student academic, fee, and personal details. The application aims to eliminate manual record keeping and speed up data retrieval. It includes modules for login, new admissions, updates, and inquiries. Data is stored in an Oracle database. The application could be improved by adding more features like online access for students and teachers, attendance tracking, and note sharing.
Implementing Server Side Data Synchronization for Mobile AppsMichele Orselli
The document describes an architecture and implementation for server-side data synchronization for mobile apps. It discusses syncing scenarios, challenges with the existing solution, and the new architecture and implementation. The key aspects covered are using GUIDs for unique identifiers, suggesting a "from" timestamp for incremental syncing, transferring record states instead of operations, and algorithms for resolving conflicts including for hierarchical data using a sort by hierarchy and updating ids.
This document contains details about creating and populating a database to store information about college society balls. It includes the entity relationship diagram and tables to store data on colleges, societies, hotels, disc jockeys, security firms, and balls. SQL statements are provided to create the tables, define primary keys and foreign keys, and insert sample data records.
This document describes the creation and testing of databases using various database management systems including Sybase ASE 15 and 16, Microsoft SQL Server 2012 and 2008 R2, and Microsoft Access 2010. It covers topics such as database creation, table design, indexing, triggers, population, verification, and manipulation of data. For each database system, details are provided about setting up the database structure, populating tables with data, running tests and queries, and addressing any issues that came up.
The project involves creating an indoor map of rooms at the Carnegie Library. It includes creating tables to store information about rooms, resources, users, and bookings. Relationships between tables are defined in an ER diagram. Sample data is inserted using SQL scripts. Forms and reports allow users and administrators to view and query data about rooms, bookings, and resources. A trigger is created to automatically update the capacity field in the rooms table when the number of chairs or tables changes. The app will help users like faculty and students locate rooms and resources within the library.
Rich relational data from thin air john stinsonJohn Stinson
The document discusses techniques for simulating relational data using a star schema model with dimension tables for devices, pages, users, and a fact table for page hits. It describes generating random user profiles based on name, gender, region distributions and simulating page hit data with timestamps based on hourly usage patterns over multiple years and devices.
This document describes a desktop application developed in Java that manages student records for a school of social sciences. It allows administrators to add, update, and view student academic, fee, and personal details. The application aims to eliminate manual record keeping and speed up data retrieval. It includes modules for login, new admissions, updates, and inquiries. Data is stored in an Oracle database. The application could be improved by adding more features like online access for students and teachers, attendance tracking, and note sharing.
Implementing Server Side Data Synchronization for Mobile AppsMichele Orselli
The document describes an architecture and implementation for server-side data synchronization for mobile apps. It discusses syncing scenarios, challenges with the existing solution, and the new architecture and implementation. The key aspects covered are using GUIDs for unique identifiers, suggesting a "from" timestamp for incremental syncing, transferring record states instead of operations, and algorithms for resolving conflicts including for hierarchical data using a sort by hierarchy and updating ids.
3. Aisling Fallon Higher Diploma in Computing
2
1. Introduction
This projectinvolved the use of oracleSQL. A set of tables and columns for an Internet Cafe User had to be
examined in order to identify the various linksbetween the tables and to establish theprimary and foreign
keys. An Entity Relationship Diagrams could then be created to show clearly the directlinks between the
tables.
When this was complete data was populated in the various columns of each table, then usingcreate table
statements and insertstatements the data was inserted into OracleSQL.
This allowed for the followingto be achieved usingselectstatements:
-DML(Data Manipulation Language)-Inserts,Updates,Deletes
-DDL(Data Description Language)-Create, Alter, Drop
-DCL(Data Control Language)-Grant Revoke
4. Aisling Fallon Higher Diploma in Computing
3
2. Data
Internet Café Users ICU
Aisling Fallon Internet Café Users ICU HDC Sep 2013
Organisation thatoperates a number of internet cafes around the country. Each cafe has a number of
computers and other gadgets (Ipads,laptops,tablets etc). Users details arestored and each time that a user
wants to avail of a computer a booking (café_user_booking) holds information aboutthe computer used, who
used itand for how long, as well as the amount charged to the customer. When computers break down or
need maintenance, one of the technicians employed by the organisation repairsthecomputer.
Internet_Café (Internet_Café_Id, Name, Address, Town, County, Web_Site, Email,Year_Opened,
Rate_Per_Hour, Facilities (Drinks, Snacks, Sandwiches)
(Note the opening and closing times are to be stored as numbers and will be whole numbers between 1 and 24
ie the 24 hour clock)
Café_User (Café_User_Id, Firstname, Lastname, Address, Town, County, Gender, Date_Of_Birth, Nationality,
Mobile_No, Email,Type (Student, Retired, Working, Unemployed), User_Level (Novice, Intermediate, Expert)
Gadget (Gadget_ID, Name, Type (Laptop, PC, Tablet etc,), Screen_Size, Hard_Disk_Size, RAM_Size,
Operating_System (eg Windows 2000,Linux, Vista etc), Video_Card (Yes, No), Sound_Card (Yes/No),
Date_Purchased, Cost_Price, Expected_Life (express in months), Resale_Value,Internet_Café_Id, Supplier_ID,)
Café_User_Booking( Café_User_ID, Gadget_Id,Date_Booked, Start_Time, End_Time, Amount_Due, Activity
(Email, Internet, Word Processing, Excel, Access, Other), Payment_Method (Cash, Credit Card, Laser Card)
Supplier (Supplier_Id,Name, Address, Country, Web_Site, Year_Founded, Specialism(PCs,Laptops,
Peripherals, Servers),Annual_Turnover)
Gadget_Repair(Gadget_Id, Repair_Date, Details,Cost, Time_Taken, (express in minutes), Technician_Id)
Technician (Technician_Id,FName, Sname, Address, Town, County, Qualifications(Certificate, Degree, MSc),
Expertise (Hardware, Software, Networks), Hourly_Rate, Date_Hired, Mobile_No)
25. Aisling Fallon Higher Diploma in Computing
24
9. Single Table Queries
Question 1
Show the internet cafes in Roscommon and Cavan which were opened after 2005,with an hourly rate of
between 3 and 5 euro and where the name of the cafe contains an “a”.
Select Name,Year_Opened, County, Rate_Per_Hour
From Internet_Cafe
Where Year_Opened >2005
And Name LIKE ‘%a%’
And County IN(’Roscommon’,’Cavan’)
And Rate_Per_Hour BETWEEN 3 AND 5;
Select Internet_Cafe.Name, Internet_Cafe.Year_Opened, Internet_Cafe.County,
Internet_Cafe.Rate_Per_Hour
From Internet_Cafe
Where Internet_Cafe.Year_Opened >2005
And Internet_Cafe.Name LIKE ‘%a%’
And Internet_Cafe.County IN(’Roscommon’,’Cavan’)
And Internet_Cafe.Rate_Per_Hour BETWEEN 3 AND 5;
26. Aisling Fallon Higher Diploma in Computing
25
Question 2
Show the first names of the cafe users except those who end with a “k”, excluding those from Cavan and
Roscommon, who have a user level and cafe user number not between 10 and 15.
Select Firstname, County, Cafe_User_Id, User_Level
From Cafe_User
Where FirstnameNOT LIKE ‘%k’
And User_Level IS NOT NULL
And County NOT IN (‘Cavan’,’Roscommon’)
And Cafe_User_Id NOT BETWEEN 10 AND 15;
Select Cafe_User.Firstname, Cafe_User.County, Cafe_User.Cafe_User_Id, Cafe_User.User_Level
From Cafe_User
Where Cafe_User.Firstname NOT LIKE ‘%k’
And Cafe_User.User_Level IS NOT NULL
And Cafe_User.County NOT IN (‘Cavan’,’Roscommon’)
And Cafe_User.Cafe_User_Id NOT BETWEEN 10 AND 15;
27. Aisling Fallon Higher Diploma in Computing
26
Question 3
Show the suppliers from Canada with a name containing an “e” that specialise in Servers and PC’s with the year
founded in ascending order.
Select Name, Country, Specialism,Year_Founded
From Supplier
Where Country=’Canada’
And SpecialismIN(‘PCs’,‘Servers’)
And Name LIKE ‘%e%’
Order By Year_Founded ASC;
Select S.Name, S.Country, S.Specialism,S.Year_Founded
From Supplier S
Where S.Country=’Canada’
And S.SpecialismIN(‘PCs’,‘Servers’)
And S.Name LIKE ‘%e%’
Order By S.Year_Founded ASC;
28. Aisling Fallon Higher Diploma in Computing
27
Question 4
Show the gadgets where the resale value is not 550 euro, also show the resale values ascending, give name
uppercase and type lowercase.
Select UPPER(Name), LOWER(Type), Cost_Price,Resale_Value
From Gadget
Where Cost_Price<>550
And Length(Name)>6
Order By Resale_Value DESC;
Select UPPER(G.Name), LOWER(G.Type), G.Cost_Price, G.Resale_Value
From Gadget G
Where G.Cost_Price<>550
And Length(Name)>6
Order By G.Resale_Value DESC;
29. Aisling Fallon Higher Diploma in Computing
28
Question 5
Show the technicians who have an hourly rate less than or equal to 20 euro, there qualification not starting
with a “D”. Also give the Surname in capitals and leave a white space on the left and right side of the name and
town.
Select RTRIM(FName), INITCAP(Sname), LTRIM(Town), Hourly_Rate, Qualifications
From Technician
Where Hourly_Rate<=5
Or QualificationsNOTLIKE ‘D%’;
Select RTRIM(T.FName), INITCAP(T.Sname), LTRIM(T.Town),T.Hourly_Rate, Qualifications
From Technician T
Where T.Hourly_Rate<=5
Or T.QualificationsNOTLIKE ‘D%’;
30. Aisling Fallon Higher Diploma in Computing
29
Question 6
Show the details of gadget repair not including “Remove virus”, “Service” and “DC Socket Repairs” where the
time taken is greater than or equal to 30mins, also showing the cost multiplied by 12 assuming each job is
performed on a monthly basis. Also show the time taken in ascending order.
Select Details,SUBSTR(Details, 1,3), Time_Taken, Cost*12
From Gadget_Repair
Where Time_Taken>=30
And Details NOT IN(‘Remove Virus’,‘Service’, ‘DC Socket Repairs’)
Order By Time_Taken ASC;
Select GR.Details,SUBSTR(GR.Details, 1,3), GR.Time_Taken, GR.Cost*12
From Gadget_Repair GR
Where GR.Time_Taken>=30
And GR.Details NOT IN(‘Remove Virus’,‘Service’, ‘DC Socket Repairs’)
Order By GR.Time_Taken ASC;
31. Aisling Fallon Higher Diploma in Computing
30
10. Joins
Question 1
(Parent Child Query involving 2 tables)
Show the firstname and qualification of the technicians and the cost and time taken for the associated
technicians of gadget repair.Show the technicians with and id of between 2000 and 2009 only, with their
address containing an “a” and the time taken in descending order.
Select Fname, Qualifications,Cost,Time_Taken, Address,Technician.Technician_Id
From Technician,Gadget_Repair
Where Technician.Technician_Id=Gadget_Repair.Technician_Id
And Address LIKE ‘%a%’
And Technician.Technician_Id BETWEEN 2000 AND 2009
Order By Time_Taken DESC;
Select Technician.Fname,Technician.Qualifications,Gadget_Repair.Cost, Gadget_Repair.Time_Taken,
Technician.Address,Technician.Technician_Id
From Technician,Gadget_Repair
Where Technician.Technician_Id=Gadget_Repair.Technician_Id
And Technician.Address LIKE‘%a%’
And Technician.Technician_Id BETWEEN 2000 AND 2009
Order By Gadget_Repair.Time_Taken DESC;
32. Aisling Fallon Higher Diploma in Computing
31
Question 2
(Parent Child Query involving 3 tables)
List the supplier’s name (in uppercase), annual turnover, specialism and year founded, also the cost price and
type of the gadgets they supply and the activity associated with the cafe users booking. Confine the output to
exclude any specialism beginning with the letter “S” and the year founded to exclude the years between 2002
and 2004.
Select UPPER(Supplier.Name), Annual_Turnover, Type, Cost_Price, Activity, Specialism,Year_Founded
From Supplier,Gadget, Cafe_User_Booking
Where Supplier.Supplier_Id=Gadget.Supplier_Id
And Gadget.Gadget_Id=Cafe_User_Booking.Gadget_Id
And SpecialismNOT LIKE ‘S%’
And Year_Founded NOT BETWEEN 2002 AND 2004;
Select UPPER(S.Name), S.Annual_Turnover, G.Type, G.Cost_Price, CUB.Activity, S.Specialism,
S.Year_Founded
From Supplier S, Gadget G, Cafe_User_Booking CUB
Where S.Supplier_Id=G.Supplier_Id
And G.Gadget_Id=CUB.Gadget_Id
And S.SpecialismNOTLIKE ‘S%’
And S.Year_Founded NOT BETWEEN 2002 AND 2004;
33. Aisling Fallon Higher Diploma in Computing
32
Question 3
(Parent Child Query involving all tables)
Using all tables show the year opened of each internet café after 2009, the counties of the café users and the
technicians in Cavan and Clare. Also show the annual turnover of the suppliers, the different types of gadgets,
the activity of the café user where the technician id is between 2000 and 2001. In the results sort the supplier’s
annual turnover starting with the lowest.
Select Internet_Cafe.Year_Opened, Cafe_User.County, Supplier.Annual_Turnover, Gadget.Type,
Cafe_User_Booking. Activity, Technician.County,Gadget_Repair.Technician_Id
From Internet_Cafe, Cafe_User, Supplier,Gadget, Cafe_User_Booking, Technician,Gadget_Repair
Where Internet_Cafe.Internet_Cafe_Id=Gadget. Internet_Cafe_Id
And Cafe_User.Cafe_User_Id=Cafe_User_Booking. Cafe_User_Id
And Supplier.Supplier_Id=Gadget.Supplier_Id
And Gadget.Gadget_Id=Cafe_User_Booking.Gadget_Id
And Technician.Technician_Id=Gadget_Repair.Technician_Id
And Technician.CountyIN(‘Cavan’,‘Clare’)
And Gadget_Repair.Technician_Id BETWEEN 2000 AND 2001
And Internet_Cafe.Year_Opened>2009
Order By Supplier.Annual_Turnover ASC;
Select IC.Year_Opened, CU.County, S.Annual_Turnover, G.Type, CUB. Activity, T.County, GR.Technician_Id
From Internet_Cafe IC, Cafe_User CU, Supplier S, Gadget G, Cafe_User_Booking CUB, Technician T,
Gadget_Repair GR
Where IC.Internet_Cafe_Id=G. Internet_Cafe_Id
And CU.Cafe_User_Id=CUB. Cafe_User_Id
And S.Supplier_Id=G.Supplier_Id
And G.Gadget_Id=CUB.Gadget_Id
And T.Technician_Id=GR.Technician_Id
And T.CountyIN(‘Cavan’, ‘Clare’)
And GR.Technician_Id BETWEEN 2000 AND 2001
And IC.Year_Opened>2009
Order By S.Annual_Turnover ASC;
34. Aisling Fallon Higher Diploma in Computing
33
Question 4
(An equijoin on two tables)
Show the first name and town of the cafe user and the name and country of the supplier where the length (in
letters) of the town is equal to the length (in letters) of the country. Confine the output to countries not in
Germany, Canada, Mexico or the United States. Give the first name uppercase and the suppliers name in lower
case.....
Select UPPER(Firstname), Cafe_User.Town, LOWER(Supplier.Name), Country
From Cafe_User, Supplier
Where Length(Cafe_User.Town)=Length(Country)
And Supplier.Country NOT IN (‘Germany’, ‘Canada’,‘Mexico’, ‘United States’);
Select UPPER(CU.Firstname), CU.Town, LOWER(S.Name), S.Country
From Cafe_User CU, Supplier S
Where Length(CU.Town)=Length(S.Country)
And S.Country NOT IN (‘Germany’, ‘Canada’,‘Mexico’, ‘United States’);
35. Aisling Fallon Higher Diploma in Computing
34
Question 5
(Non Equijoin between 2 tables)
List the names and year opened of the internet cafes in 2010 or after and the name of the suppliers and year
founded where the year opened of the internet cafe exceeds the year founded of the supplier. Also show the
difference in years between the year opened and year founded.
Select INITCAP(Internet_Cafe.Name),Year_Opened,INITCAP(Supplier.Name), Year_Founded, Year_Opened-
Year_Founded “Difference in Years”
From Internet_Cafe, Supplier
Where Year_Opened>Year_Founded
And Year_Opened>=2010;
Select IC.Name,IC.Year_Opened, INITCAP(S.Name), S. Year_Founded, IC.Year_Opened-S.Year_Founded
“Difference in Years”
From Internet_Cafe IC, Supplier S
Where IC.Year_Opened>S.Year_Founded
And IC.Year_Opened>=2010;
36. Aisling Fallon Higher Diploma in Computing
35
Question 6
(A Self join)
Show the name and screen sizes of the gadgets where the screen sizes are the same size. Show the screen size
(in inches) in ascending order.
Select G1.Name, G1.Screen_Size_Inches, G2.Name, G2.Screen_Size_Inches
From Gadget G1, Gadget G2
Where G1.Screen_Size_Inches= G2.Screen_Size_Inches
And G1.Gadget_Id<G2.Gadget_Id
Order By G1.Screen_Size_Inches ASC;
37. Aisling Fallon Higher Diploma in Computing
36
Question 7
(Outer Join)
Give the first names of the technicians and the associated cost for the gadget repair including technicians who
may not yet have had a gadget to repair. Sort the cost in descending order.
Select (Fname) “Firstname”, (Cost) “Total Cost”
From Technician,Gadget_Repair
Where Technician.Technician_Id=Gadget_Repair.Technician_Id(+)
Order byCost DESC;
Select (Technician.Fname) “Firstname”, (Gadget_Repair.Cost) “Total Cost”
From Technician,Gadget_Repair
Where Technician.Technician_Id=Gadget_Repair.Technician_Id(+)
Order byGadget_Repair.Cost DESC;
38. Aisling Fallon Higher Diploma in Computing
37
11. Summary Queries
Question 1
Find the maximum and minimum time taken for technicians in gadget repair and also the average cost, where
the details of repair contain an “e”.
Select Max(GR.Time_Taken), Min(GR.Time_Taken), Avg(GR.Cost)
From Gadget_Repair GR
Where Gr.DetailsLIKE’%e%’;
Question 2
Find the number of gadgets including the average hard disk size and the sum of the cost price for each one,
excluding the gadgets that end with the letter “n” and have a resale value between 300 and 500 euro.
Select Sum(G.Cost_Price), Avg(G.Hard_Disk_Size_Inches), Count(G.Gadget_Id)
From Gadget G
Where G.Resale_Value NOT BETWEEN 300 and 500
And G.Name NOT LIKE ‘%n’;
39. Aisling Fallon Higher Diploma in Computing
38
Question 3
Count the number of suppliers who have no email address.
Select Count(*)
From Supplier S
Where S.Web_Site IS NULL;
Question 4
Find the maximum and minimum rate per hour for the Internet Cafes which have no facilities.
Select Max(IC.Rate_Per_Hour), Min(IC.Rate_Per_Hour)
From Internet_Cafe IC
Where IC.Facilities IS NULL;
40. Aisling Fallon Higher Diploma in Computing
39
Question 5
Show the min and max annual turnover for suppliers and the difference between them, where the year founded
is less than or equal to 2008.
Select Max(S.Annual_Turnover) Highest , Min(S.Annual_Turnover) Lowest, Max(S.Annual_Turnover)-
Min(S.Annual_Turnover) Difference
From Supplier S
Where S.Year_Founded<=2008;
Question 6
Show the gadget types along with the max and min screen size for each type and the average ram size for each
of the types. Show the results in reverse alphabetical order by type and where the length of “type” (in letters) is
greater than 5.
Select G.Type, Max(G.Screen_Size_Inches) “Max Screen Size”, Min(G.Hard_Disk_Size_Inches) “Min Screen
Size”, Avg(G.Ram_Size)
From Gadget G
Where Length(G.Type)>5
Group By G.Type
Order By G.TypeDESC;
41. Aisling Fallon Higher Diploma in Computing
40
Question 7
List each technician name, the average time taken to do the job, the sum of the cost and the number of jobs
each technician had, where the time taken is greater than 100 minutes, arrange the names in alphabetical
order.
Select T.Fname,Avg(GR.Time_Taken), Sum(GR.Cost),Count(*)
From Technician T, Gadget_Repair GR
Where T.Technician_Id=GR.Technician_Id
And GR.Time_Taken>100
Group By T.Fname
Order By T.Fname ASC;
Question 8
Listthe activity types for the café user, showingalso the lateststarttime and the sum of the amount due for
each activity,where the amount due is greater than or equal to 10. Also sort the amount due in ascending
order.
Select CUB.Activity, (CUB.Start_Time)”Latest Time”, Sum(CUB.Amount_Due)
From Cafe_User_Booking CUB
Group By CUB.Activity
Having Sum(CUB.Amount_Due)>=10
Order By Sum(CUB.Amount_Due) ASC;
42. Aisling Fallon Higher Diploma in Computing
41
Question 9
Listthe names of the internet cafes in Cavan with an hourly rate of €5 or in Sligo with an hourly rate of €4, with
the year opened is between 2005 and 2008 in descending oreder……………
Select IC.Name, Sum(IC.Rate_Per_Hour), Sum(IC.Year_Opened)
From Internet_Cafe IC
Where (IC.County=’Cavan’ and IC.Rate_Per_Hour=5)
Or (IC.County=’Sligo’ and Rate_Per_Hour=4)
Group By IC.Name
Having Sum(IC.Year_Opened) BETWEEN 2005 and 2008
Order By Sum(IC.Year_Opened) DESC;
43. Aisling Fallon Higher Diploma in Computing
42
12. Subqueries
Question 1
Select the name of the gadgets with the highest cost price, where the resale value is between 450 and 600.
Select Name
From Gadget
Where Cost_PriceIN
(Select Max(Cost_Price)
From Gadget
Where Resale_ValueBETWEEN 450 AND 600);
44. Aisling Fallon Higher Diploma in Computing
43
Question 2
Name the suppliers who live in Germany and have an annual turnover less than the highest annual turnover of
a supplier in Canada and where the names do not end with an “l”.
Select Name, Annual_Turnover
From Supplier
Where Name NOT LIKE ‘%l’
And Country=’Germany’
And Annual_Turnover<
(Select Max(Annual_Turnover)
From Supplier
Where Country=’Canada’
And Name NOT LIKE ‘%l’);
45. Aisling Fallon Higher Diploma in Computing
44
Question 3
Name the technicians with Degrees who have an hourly rate greater than the average hourly rate for
technicians with no qualification.
Select T.FName
From Technician T
Where T.Qualifications=’Degree’
And T.Hourly_Rate>
(Select Avg(T.Hourly_Rate)
From Technician T
Where T.QualificationsIS NULL);
46. Aisling Fallon Higher Diploma in Computing
45
Question 4
Name the café users with an id between 10 and 25, who are unemployed and have the same nationality as
student café users.
Select Firstname, Nationality
From Cafe_User
Where Type=’Unemployed’
And Cafe_User_Id BETWEEN 10 and 25
And Nationality IN
(Select Nationality
From Cafe_User
Where Type=’Student’
And Cafe_User_Id BETWEEN 10 and 25);
47. Aisling Fallon Higher Diploma in Computing
46
Question 5
Show the name, town and facilities of an internet café who have PC as their gadgets and their name contains a
“u”.
Select Name, Town, Facilities
From Internet_Cafe
Where Name LIKE ‘%u%’
And Internet_Cafe .Internet_Cafe_IdIN(
Select Gadget.Internet_Cafe_Id
From Gadget
Where Type=’PC’);
48. Aisling Fallon Higher Diploma in Computing
47
Question 6
Show the name, town and facilities of an internet café who do not have PC as their gadgets and contain the
letter “u” in their name.
Select Name, Town, Facilities
From Internet_Cafe
Where Name LIKE ‘%u%’
And Internet_Cafe .Internet_Cafe_Id NOT IN(
Select Gadget.Internet_Cafe_Id
From Gadget
Where Type=’PC’);
49. Aisling Fallon Higher Diploma in Computing
48
Question 7
List the names and year founded of the suppliers of gadgets with an annual turnover less than 65000 and
where the length of the café user booking activity associated to the gadget is the same as the length of the
payment method(in letters).
Select Supplier.Name, Supplier.Year_Founded
From Supplier
Where Annual_Turnover< 65000
And Supplier.Supplier_IdIN(
Select Gadget.Supplier_Id
From Gadget
Where Gadget.Gadget_IdIN(
Select Cafe_User_Booking.Gadget_Id
From Cafe_User_Booking
Where
Length(Cafe_User_Booking.Activity)=Length(Caf
e_User_Booking.Payment_Method)));
50. Aisling Fallon Higher Diploma in Computing
49
Question 8
List the café user activity where the length of the café user booking activity is the same as the length of the
payment method(in letters)…..and where the annual turnover is less than 65000 for supplier….
Select Activity
From Cafe_User_Booking
Where Length(Cafe_User_Booking.Activity)=Length(Cafe_User_Booking.Payment_Method)
And Cafe_User_Booking.Gadget_IdIN(
Select Gadget.Gadget_Id
From Gadget
Where Gadget.Supplier_IdIN(
Select Supplier.Supplier_Id
From Supplier
Where Annual_Turnover< 65000));
51. Aisling Fallon Higher Diploma in Computing
50
Question 9
Show the name and year opened of internet cafes where the year opened is after 2003, the cost price of the gadget
associated to the café is greater than 300, where the café user booking activity is email, internet or access, the nationality
of the café user is French or Irish, the annual turnover is greater than 50000 for the supplier of the internet café, the tim e
taken for the gadget repair is greater than 25 minutes and the technician from either Cavan, Clare or Roscommon.
Select Internet_Cafe.Year_Opened, Internet_Cafe.Name
From Internet_Cafe
Where Internet_Cafe.Year_Opened>2003
And Internet_Cafe.Internet_Cafe_IdIN(
Select Gadget.Internet_Cafe_Id
From Gadget
Where Gadget.Cost_Price>300
And Gadget.Gadget_IdIN(
Select Cafe_User_Booking. Gadget_Id
From Cafe_User_Booking
Where Cafe_User_Booking. ActivityIN(‘Email’,’Internet’, ‘Access’)
And Cafe_User_Booking.Cafe_User_IdIN(
Select Cafe_User.Cafe_User_Id
From Cafe_User
Where Cafe_User.NationalityIn(‘Irish’, ‘French’)
And Gadget.Supplier_IdIN(
Select Supplier.Supplier_Id
From Supplier
Where Supplier.Annual_Turnover>50000
And Gadget.Gadget_IdIN(
Select Gadget_Repair.Gadget_Id
From Gadget_Repair
Where Gadget_Repair.Time_Taken>15
AndGadget_Repair.Technician_IdIN(
Select Technician.Technician_Id
From Technician
Where Technician.CountyIN(‘Cavan’, ‘Clare’,
‘Roscommon’)))))));
52. Aisling Fallon Higher Diploma in Computing
51
Select DISTINCT Internet_Cafe.Year_Opened, Internet_Cafe.Name
From Internet_Cafe, Gadget, Cafe_User_Booking, Cafe_User, Supplier, Gadget_Repair, Technician
Where Internet_Cafe.Internet_Cafe_Id=Gadget.Internet_Cafe_Id
And Gadget.Gadget_Id=Cafe_User_Booking. Gadget_Id
And Cafe_User_Booking.Cafe_User_Id=Cafe_User.Cafe_User_Id
And Gadget.Supplier_Id=Supplier.Supplier_Id
And Gadget.Gadget_Id=Gadget_Repair.Gadget_Id
And Gadget_Repair.Technician_Id=Technician.Technician_Id
And Internet_Cafe.Year_Opened>2003
And Gadget.Cost_Price>300
And Cafe_User_Booking. Activity IN(‘Email’,’Internet’, ‘Access’)
And Cafe_User.NationalityIn(‘Irish’, ‘French’)
And Supplier.Annual_Turnover>50000
And Gadget_Repair.Time_Taken>15
And Technician.CountyIN(‘Cavan’,‘Clare’, ‘Roscommon’);
53. Aisling Fallon Higher Diploma in Computing
52
Question 10
List the technician’s first name and surname where the cost of their gadget repair is not greater than €15.
Select T.Fname, T.Sname
From Technician T
Where T.Technician_Id NOT IN(
Select GR.Technician_Id
From Gadget_Repair GR
Where GR.Cost>15);
54. Aisling Fallon Higher Diploma in Computing
53
Question 11
List the names of the suppliers(at least one) who supply laptops who have an annual turnover greater than the
supplier of netbooks.
Select S.Name, S.Annual_Turnover
From Supplier S, Gadget G
Where S.Supplier_Id=G.Supplier_Id
And G.Type=’Laptop’
And S.Annual_Turnover>ANY
(Select S.Annual_Turnover
From Supplier S, Gadget G
Where S.Supplier_Id=G.Supplier_Id
And G.Type=’Netbook’);
55. Aisling Fallon Higher Diploma in Computing
54
Question 12
Name all the technicians from Cavan that spend less time doing gadget repairs compared to all the technicians
who come from Roscommon.
Select T.Fname
From Technician T, Gadget_Repair GR
Where T.Technician_Id=GR.Technician_Id
And T.County=’Cavan’
And Gr.Time_Taken<ALL
(Select Gr.Time_Taken
From Technician T, Gadget_Repair GR
Where T.Technician_Id = GR.Technician_Id
And T.County=’Roscommon’);
56. Aisling Fallon Higher Diploma in Computing
55
13. Inserts, Updates and Deletes
Question 1
Failed delete due to integrity constraint.
Delete
From Technician
Where Technician_Id=2001;
57. Aisling Fallon Higher Diploma in Computing
56
Question 2
Remove the cafe users who use credit card as a payment method
Delete
From Cafe_User
Where Cafe_User.Cafe_User_IdIN(
Select Cafe_User_Booking.Cafe_User_Id
From Cafe_User_Booking
Where Payment_Method=’Credit Card’);
Remove the café users from Cavan as they no longer make a booking.
Select Activity
From Cafe_User_Booking
Where Cafe_User_Booking.Cafe_User_IdIN(
Select Cafe_User. Cafe_User_Id
From Cafe_User
Where County=’Cavan’);
Delete
From Cafe_User_Booking
Where Cafe_User_Booking.Cafe_User_IdIN(
Select Cafe_User. Cafe_User_Id
From Cafe_User
Where County=’Cavan’);
59. Aisling Fallon Higher Diploma in Computing
58
Question 3
Café Users who are assigned to gadgets where their suppliers have an annual turnover less than 58000 should
be removed.
Select Activity
From Cafe_User_Booking
Where Cafe_User_Booking.Gadget_IdIN(
Select Gadget. Gadget_Id
From Gadget
Where Gadget.Supplier_IdIN(
Select Supplier.Supplier_Id
From Supplier
Where Annual_Turnover< 58000));
Delete
From Cafe_User_Booking
Where Cafe_User_Booking.Gadget_IdIN(
Select Gadget. Gadget_Id
From Gadget
Where Gadget.Supplier_IdIN(
Select Supplier.Supplier_Id
From Supplier
Where Annual_Turnover< 58000));
Rollback;
60. Aisling Fallon Higher Diploma in Computing
59
Question 4
Delete the internet cafes who do not have PCs as their gadget types and contain the letter “u” in their name
(ON DELETE CASCADE).
Select Name, Town, Facilities
From Internet_Cafe
Where Name LIKE ‘%u%’
And Internet_Cafe .Internet_Cafe_Id NOT IN
(Select Gadget.Internet_Cafe_Id
From Gadget
Where Type=’PC’);
Delete
From Internet_Cafe
Where Name LIKE ‘%u%’
And Internet_Cafe .Internet_Cafe_Id NOT IN
(Select Gadget.Internet_Cafe_Id
From Gadget
Where Type=’PC’);
Rollback;
63. Aisling Fallon Higher Diploma in Computing
62
Question 8
Show the details and costfor gadget repair for technician 2006 and then attempt to update to 2020,then
successfully updateto 2007….
Select Details,Cost
From Gadget_Repair
Where Technician_Id=2006;
Update Gadget_Repair
Set Technician_Id=2020
Where Technician_Id=2006;
Update Gadget_Repair
Set Technician_Id=2007
Where Technician_Id=2006;
Rollback;
64. Aisling Fallon Higher Diploma in Computing
63
Question 9
Attempt to update a primary key for a parent that has children.
Select Name, Address
From Supplier
Where Supplier_Id=55;
Update Supplier
Set Supplier_Id=56
Where Supplier_Id=55;
65. Aisling Fallon Higher Diploma in Computing
64
Question 10
On Delete Cascade feature for all foreign keys
Delete
From Cafe_User_Booking
Where Cafe_User_Booking.Gadget_IdIN(
Select Gadget. Gadget_Id
From Gadget
Where Gadget.Supplier_IdIN(
Select Supplier.Supplier_Id
From Supplier
Where Annual_Turnover< 58000
Select Count(*)
From Cafe_User_Booking;
Select Count(*)
From Gadget;
66. Aisling Fallon Higher Diploma in Computing
65
Select Count(*)
From Supplier;
Select Count(*)
From Cafe_User_Booking
Where Gadget_Id=1000;
Select Count(*)
From Gadget
Where Gadget_Id=1000;
67. Aisling Fallon Higher Diploma in Computing
66
Select Count(*)
From Supplier
Where Supplier.Supplier_IdIN(
Select Gadget.Supplier_Id
From Gadget
Where Gadget_Id=1000);
Delete From Cafe_User_Booking
Where Gadget_Id=1000;
68. Aisling Fallon Higher Diploma in Computing
67
Delete
From Gadget
Where Gadget_Id=1000;
Delete
From Supplier
Where Supplier.Supplier_IdIN(
Select Gadget.Supplier_Id
From Gadget
Where Gadget_Id=1000);
70. Aisling Fallon Higher Diploma in Computing
69
14. Views
Question 1
Create a vertical view to show the name, address, country, specialism and annual turnover for the supplier of
laptops.
Drop View Supplier_Laptops;
Create View Supplier_Laptops As
Select Name, Address,Country, Specialism,Annual_Turnover
From Supplier;
Select Name, Country, Address, Specialism,Annual_Turnover
From Supplier_Laptops;
71. Aisling Fallon Higher Diploma in Computing
70
Question 2
Create a horizontal view using all columns in the supplier table.
Drop View Supplier_Laptops;
Create View Supplier_Laptops(Supplier_Id,Name, Address,Country, Web_Site, Year_Founded,
Specialism,Annual_Turnover,Monthly_Wage)As
Select Supplier_Id,Name, Address,Country, Web_Site, Year_Founded, Specialism,Annual_Turnover,
Annual_Turnover/12
From Supplier
Where Specialism=’Laptops’
And Year_Founded<2005;
Select *
From Supplier_Laptops;
72. Aisling Fallon Higher Diploma in Computing
71
Question 3
Create a view based on a join of at least three tables.
Drop View Supplier_Gadget_Cafe_User_Book; As
Create View Supplier_Gadget_Cafe_User_Book As
Select Supplier.Name, Supplier.Country,Gadget.Type, Gadget.Cost_Price, Cafe_User_Booking.Amount_Due,
Cafe_User_Booking.Activity, Cafe_User_Booking.Payment_Method
From Supplier,Gadget, Cafe_User_Booking
Where Supplier.Supplier_Id=Gadget.Supplier_Id
And Gadget.Gadget_Id=Cafe_User_Booking.Gadget_Id;
Select *
From Supplier_Gadget_Cafe_User_Book;
Select Supplier.Name, Gadget.Type, Cafe_User_Booking.Activity
From Supplier_Gadget_ Cafe_User_Booking;
73. Aisling Fallon Higher Diploma in Computing
72
Question 4
Create a view based on a summary query.
Drop View Gadget_Repair_Time_Cost;
Create View Gadget_Repair_Time_Cost As
Select Details,Max(Time_Taken) Max_Time, Min(Time_Taken)Min_Time, Avg(Cost) Avg_Cost
From Gadget_Repair GR
Group By Details;
DescribeGadget_Repair_Time_Cost;
Select *
From Gadget_Repair_Time_Cost;
74. Aisling Fallon Higher Diploma in Computing
73
Question 5
Create a view based on a singletablethat doesn’t have a WITH CHECK OPTION clause and attempt an insert
and update.
Drop View Internet_Cafe_Opened_County;
Create View Internet_Cafe_Opened_County As
Select Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour, Facilities
From Internet_Cafe
Where Year_Opened >2005
And Name LIKE ‘%n%’
And County IN(’Roscommon’,’Clare’);
Select Count(*)
From Internet_Cafe_Opened_County;
Select *
From Internet_Cafe_Opened_County;
Insertinto Internet_Cafe_Opened_County(Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour,
Facilities)
Values(259,‘Techet’, 2003, ‘Sligo’,4, ‘Drinks’);
75. Aisling Fallon Higher Diploma in Computing
74
Insertinto Internet_Cafe_Opened_County(Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour,
Facilities)
Values(256,‘Cruising’,2007,‘Roscommon’, 4, ‘Drinks’);
Select Count(*)
From Internet_Cafe_Opened_County;
Select *
From Internet_Cafe_Opened_County;
UPDATE
Update Internet_Cafe_Opened_County
Set County=’Galway’
Where County=’Roscommon’;
76. Aisling Fallon Higher Diploma in Computing
75
Update Internet_Cafe_Opened_County
Set Name=’Techno’
Where Name= ‘Gamestation Cafe’;
In this view all the inserts and updates succeeded even though some of them did not meet the conditions
outlined, this was because the view did not contain a with check option
77. Aisling Fallon Higher Diploma in Computing
76
Question 6
Create the same view but include a WITH CHECK OPTION for an insert, update and delete.
Drop View Internet_Cafe_Opened_County;
Create View Internet_Cafe_Opened_County As
Select Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour, Facilities
From Internet_Cafe
Where Year_Opened >2005
And Name LIKE ‘%n%’
And County IN(’Roscommon’,’Clare’)
With Check Option;
Insertinto Internet_Cafe_Opened_County(Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour,
Facilities)
Values(259,‘Techet’, 2003, ‘Sligo’,‘4’, ‘Drinks’);
Insertinto Internet_Cafe_Opened_County(Internet_Cafe_Id, Name,Year_Opened, County, Rate_Per_Hour,
Facilities)
Values(256,‘Cruising’,2007,‘Roscommon’, 4, ‘Drinks’);
78. Aisling Fallon Higher Diploma in Computing
77
Select Count(*)
From Internet_Cafe_Opened_County;
Select *
From Internet_Cafe_Opened_County;
UPDATE
Update Internet_Cafe_Opened_County
Set County=’Galway’
Where County=’Roscommon’;
Update Internet_Cafe_Opened_County
Set Name=’Techno’
Where Name= ‘Gamestation Cafe’;
79. Aisling Fallon Higher Diploma in Computing
78
DELETE
Delete
From Internet_Cafe_Opened_County
Where Internet_Cafe_Id=103;
Delete
From Internet_Cafe_Opened_County
Where County=’Roscommon’;
The insert that doesn’t comply with the where clause restriction will fail due to the with check option(where-
clause violation) The insert which should comply will simply be inserted. The same can be said for the
updates….the first one which did not meet the conditions failed due to the check option again, however the
one which met the conditions in the view updated without any problem.
80. Aisling Fallon Higher Diploma in Computing
79
Question 7
Attempt an invalid insert into a view containing a WITH CHECK OPTION clause, demonstrating when it succeeds
and fails.
Drop View Supplier_Canada;
Create View Supplier_Canada As
Select Supplier_Id,Annual_Turnover, Name, Country, Web_Site, Address, Year_Founded, Specialism
From Supplier
Where Country=’Canada’
With Check Option;
Select *
From Supplier_Canada;
Insertinto Supplier_Canada(Supplier_Id,Annual_Turnover,Name, Country, Web_Site, Address, Year_Founded,
Specialism)Values(84,60000,‘Techo’, ‘Canada’,‘www.techo.com’, ‘Dublin’, 2006,‘Servers’);
Insertinto Supplier_Canada(Supplier_Id,Annual_Turnover,Name, Country, Web_Site, Address, Year_Founded,
Specialism)Values(50,60000,‘Techo’, ‘Ireland’,‘www.techo.com’, ‘Dublin’, 2006,‘Servers’);
81. Aisling Fallon Higher Diploma in Computing
80
Question 8
Attempt an invalid update into a view containing a WITH CHECK OPTION clause, also showing the update when
it succeeds.
Drop View Gadget_Repair_Details;
Create View Gadget_Repair_Details As
Select Details,Cost, Technician_Id
From Gadget_Repair
Where Cost<50
And Details LIKE’%n%’
WITH CHECK OPTION;
Select *
From Gadget_Repair_Details;
Update Gadget_Repair_Details
Set Details=’Repair’
Where Technician_Id=2003;
Update Gadget_Repair_Details
Set Details=’Re-install’
Where Technician_Id=2003;
82. Aisling Fallon Higher Diploma in Computing
81
Alter Tables
Question 1
(Adding a column to a table)
Alter TableGadget
Add Region Varchar2(12);
Alter TableGadget
DROP Column Region;
Question 2
(Add a column with check constraint)
Alter TableGadget
Add ConstraintGadget_Region_CK Check (Region In(‘NORTH’, ‘SOUTH’,’EAST’));
83. Aisling Fallon Higher Diploma in Computing
82
Question 3
(Increasewidth of existingcolumn)
Alter TableGadget
Modify Region Varchar2(12);
Question 4
(Remove a column from a table)
DROP Column Region;
84. Aisling Fallon Higher Diploma in Computing
83
Question 5
(Drop a Pk constraintbut you need to drop Fk constraintfirst)
Alter TableGadget
Drop ConstraintGad_Supplier_Id_FK;
Alter TableSupplier
Drop ConstraintSupplier_Supplier_Id_PK;
Question 6
(Add the pk constraintyou justdropped)
Alter TableSupplier
Add ConstraintSupplier_Supplier_Id_PK Primary Key(Supplier_Id);
Alter TableGadget
Add ConstraintGad_Supplier_Id_FK Foreign Key(Supplier_Id) References Supplier(Supplier_Id);
85. Aisling Fallon Higher Diploma in Computing
84
Question 7
(Drop a Fk Constraint)
Alter TableGadget
Drop ConstraintGad_Supplier_Id_FK;
Question 8
(Disableand enablea foreign key constraint)
Alter TableGadget
DisableConstraintGad_Supplier_Id_FK;
86. Aisling Fallon Higher Diploma in Computing
85
14. Security
Question 1
(Grant select, update and delete to two students).
Grant select on Supplier to student145, student142;
Grant inserton Supplier to student145, student142;
Grant update on Supplier to student145, student142;
Question 2
(Grant permission on select to public)
Grant select on Gadget to Public;
87. Aisling Fallon Higher Diploma in Computing
86
Question 3
(Grant two conditions to one student)
Grant select, update on Gadget_Repair to student145;
Question 4
(Grant select with permission for the privileges to be passed on)
Grant select on Internet_Cafe to student142 with grantoption;
Question 5
(Grant a student select and insert to a view)
Grant select, inserton Supplier_Laptops to student142;
88. Aisling Fallon Higher Diploma in Computing
87
Question 6
(Grant an update and delete on a view to two students)
Grant update, delete on Supplier_Laptops to student142, student145;
Question 7
(Revoke privileges from one of the students)
Revoke select, update on Gadget_Repair from student145;
Question 8
(Revoke privileges from the other students)
Revoke select, inserton Supplier_Laptops from student142;
89. Aisling Fallon Higher Diploma in Computing
88
14. Transaction Processing
Time Session1 (client1) Session2 (client2) Observations
T1 Select Sum(Cost)
From Gadget_Repair;
Select Sum(Cost)
From Gadget_Repair;
Both Client1 and Client2 can see the the
result-Sum(Cost)
T2 Update Gadget_Repair
Set Cost=Cost +10
Where Technician_Id=2002;
Client1 has updated rows in the Gadget
Repair table, no other clientcan update
these rows until client1 completes the
transcation
90. Aisling Fallon Higher Diploma in Computing
89
T3 Select Sum(Cost)
From Gadget_Repair;
Select Sum(Cost)
From Gadget_Repair;
Here you can see Client1 update rows
on the Gadget Repair table. Client 2 has
not yet been updated.
T4 Update Gadget_Repair
Set Cost=Cost +10
Where
Technician_Id=2002;
Here you can see Client2 is blocked as
the rows arelocked by Client1
T5 Select Sum(Cost)
From Gadget_Repair;
Select Sum(Cost)
From Gadget_Repair;
T6 Rollback; Now client2 update will be processed as
the transaction is completed by client1
due to the rollback.Now Client1
updates arereversed whileclient2 is
now updated.
91. Aisling Fallon Higher Diploma in Computing
90
T7 Select Sum(Cost)
From Gadget_Repair;
Select Sum(Cost)
From Gadget_Repair;
Client1 will nowsees the original while
client2 will seethe updates.
T8 Rollback;
T9 Select Sum(Cost)
From Gadget_Repair;
Select Sum(Cost)
From Gadget_Repair;
Now client1 and client2 will both have
the same amount for Sum(Cost)
92. Aisling Fallon Higher Diploma in Computing
91
TIME SESSION1 (CLIENT1) SESSION2
(CLIENT2)
SESSION3
(CLIENT3)
OBSERVATIONS
T1 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
All clients will seethis result
T2 Update
Gadget_Repair
Set Cost=Cost +10
Where
Technician_Id=200
2;
93. Aisling Fallon Higher Diploma in Computing
92
T3 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
This will haveclientone with the
new update figureand client2
and 3 with the original figure
T4 Update
Gadget_Repair
Set Cost=Cost
+10
Where
Technician_Id=20
02;
This will notupdate as client1
updates arenot processed this
will stay in waitingmode until
client1 rollbacksor commits.
94. Aisling Fallon Higher Diploma in Computing
93
T5 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
T6 Update
Gadget_Repair
Set Cost=Cost +10
Where
Technician_Id=20
02;
95. Aisling Fallon Higher Diploma in Computing
94
T7 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Client2 and Client3 will notupdate
as Client1 has not been commited
or rollback.
T8 Rollback; Rollback; Rollback;
96. Aisling Fallon Higher Diploma in Computing
95
T9 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
The updates have been rolled
back so now the 3 clients havethe
same figure.
T10 Update
Gadget_Repair
Set Cost=Cost +10
Where
Technician_Id=200
2;
97. Aisling Fallon Higher Diploma in Computing
96
T11 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
T12 Update
Gadget_Repair
Set Cost=Cost
+10
Where
Technician_Id=20
02;
T13 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
98. Aisling Fallon Higher Diploma in Computing
97
T14 Commit;
T15 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
When itis commited atclient1 the
update then runs for client2.
T16 Commit;
99. Aisling Fallon Higher Diploma in Computing
98
T17 Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Select Sum(Cost)
From
Gadget_Repair;
Client1 and Client2 have
commited so therefore updates
will occur for all threeclients.