Your SlideShare is downloading. ×
0
Database Development
PostgreSQL 9.2.4 & Sybase IQ 15.4
By
Sunny Okoro
1
Table of Contents
Database Systems.........................................................................................
2
Database Systems
PostgresSQL 9.2.4
Sybase IQ 15.4
3
Applications
Oracle JDeveloper
Microsoft Visual Studio
Sybase Central for IQ and ASE Database
4
Microsoft PowerPivot
Oracle SQL Developer Data Modeler
Microsoft Visio 2010
5
Sybase PowerDesigner
6
PostgreSQL 9.2.4
7
Loading Sample Database –DVDRental
Verification
8
Database Diagram-DVDRental
Data Manipulation
SELECT
public.payment.payment_id,
public.payment.customer_id,
public.paymen...
9
Results Abridged
SELECT
public.payment.payment_id,
public.payment.customer_id,
public.payment.staff_id,
public.payment.r...
10
SELECT
public.payment.payment_id,
public.payment.customer_id,
public.payment.staff_id,
public.payment.rental_id,
public...
11
Results Abridged
SELECT
public.payment.customer_id,
to_char(sum( public.payment.amount),'$999,999.99' )as Total_Payment...
12
to_char(round(avg ( public.payment.amount),2),'$999,999.99')as Avg_Payment ,
initcap( public.customer.first_name ||','|...
13
195 $ 86.81 $ 11.99 $ .99 $ 4.57 Vanessa,Sims
116 $ 106.74 $ 11.99 $ .99 $ 4.11 Victoria,Gibson
customer_id total_payme...
14
60 $ 88.78 $ 9.98 $ .00 $ 4.04 Mildred,Bailey
576 $ 135.68 $ 8.99 $ .00 $ 4.24 Morris,Mccarter
216 $ 90.78 $ 8.99 $ .00...
15
16
customer_name total_payment highest_payment smallest_payment avg_payment rental_history
Allen,Butterfield 74.83 8.99 0....
17
18
19
Data Definition
select * from public.rentalhistory
20
customer_name total_payment highest_payment smallest_payment avg_payment rental_history
Vickie,Brewer 100.75 8.99 0.99 ...
21
CREATE TABLE rentalhistorymax
(
customer_id integer,
customer_name text,
total_payment numeric,
highest_payment numeric...
22
customer_id customer_name total_payment highest_payment smallest_payment avg_payment rental_history
13 Karen,Jackson 13...
23
116 Victoria,Gibson 106.74 11.99 0.99 4.11 Feud Frogmen-0.99, Love Suicides-0.99, Pelican Comforts-4.99, Hanging Deep-4...
24
create or replace view rentakhistoryavg
as
SELECT
customer.customer_id, customer.first_name||','||customer.last_name As...
25
customer_id customer_name total_payment highest_payment smallest_payment avg_payment rental_history
109 Edna,West 79.81...
26
Cider-0.99, Saddle Antitrust-2.99, Alaska Phantom-0.99, Clueless Bucket-5.99, Birdcage
Casper-1.99, Anonymous Human-1.9...
27
28
29
30
31
32
Table Creations
33
34
35
36
37
Object Verifications
38
39
Table Population Statements
40
Data Verification
41
42
43
44
45
46
Database Security-Audits
47
Audit Validation
User: public
48
49
50
51
52
Objects Verification
53
54
Each of the tables created will contain the additional information related to thetriggers used for data auditing compar...
55
Database Backup and Revision
Due to a system error I had to uninstall postgres server and reinstall the server. As resu...
56
57
Once the database has been restored, I continued working on the database development and made few adjustments. A new co...
58
59
60
Indexes Metadata
61
Constraints metadata
62
63
Triggers Metadata
64
65
66
Sybase IQ 15.4
67
Database Creation
68
69
70
Database Verification
71
Library Database
72
Objects Creation
73
74
75
Objects Verification
In the following demonstrations I would use Sybase Central to view each objects definition and lat...
76
77
In the following demonstration below I would use the system stored procedure to retrieve the table structures relating ...
78
79
80
Data Loading
81
82
83
Database Revision
Few changes were made to the database.
84
85
86
Data Validation
87
88
89
Data Manipulation
90
91
92
93
94
Functions and Stored Procedures
95
96
97
98
99
DBA Tasks
100
101
102
103
104
105
106
Database Diagram
107
108
109
110
Upcoming SlideShare
Loading in...5
×

DB Devlop- PostgreSQL 9.2.4 IQ 15.4

967

Published on

Published in: Business, Economy & Finance
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
967
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "DB Devlop- PostgreSQL 9.2.4 IQ 15.4"

  1. 1. 0 Database Development PostgreSQL 9.2.4 & Sybase IQ 15.4 By Sunny Okoro
  2. 2. 1 Table of Contents Database Systems.........................................................................................................................................2 Applications..................................................................................................................................................3 PostgreSQL 9.2.4.........................................................................................................................................6 Sybase IQ 15.4............................................................................................................................................66
  3. 3. 2 Database Systems PostgresSQL 9.2.4 Sybase IQ 15.4
  4. 4. 3 Applications Oracle JDeveloper Microsoft Visual Studio Sybase Central for IQ and ASE Database
  5. 5. 4 Microsoft PowerPivot Oracle SQL Developer Data Modeler Microsoft Visio 2010
  6. 6. 5 Sybase PowerDesigner
  7. 7. 6 PostgreSQL 9.2.4
  8. 8. 7 Loading Sample Database –DVDRental Verification
  9. 9. 8 Database Diagram-DVDRental Data Manipulation SELECT public.payment.payment_id, public.payment.customer_id, public.payment.staff_id, public.payment.rental_id, public.payment.amount, public.payment.payment_date, public.customer.first_name ||','||public.customer.last_name as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id;
  10. 10. 9 Results Abridged SELECT public.payment.payment_id, public.payment.customer_id, public.payment.staff_id, public.payment.rental_id, public.payment.amount, public.payment.payment_date, upper( public.customer.first_name ||','||public.customer.last_name)as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id; payment_id customer_id staff_id rental_id amount payment_date customer_name 17512 343 2 1547 4.99 2/16/2007 0:10 DOUGLAS,GRAF 17520 344 2 1475 4.99 2/15/2007 19:36 HENRY,BILLINGSLEY 17525 345 2 2766 4.99 2/19/2007 16:13 CARL,ARTIS 17552 352 2 3331 4.99 2/21/2007 8:06 ALBERT,CROUSE 17575 359 2 1329 4.99 2/15/2007 9:53 WILLIE,MARKHAM 17583 361 2 2353 4.99 2/18/2007 11:21 LAWRENCE,LAWTON 17592 363 2 1426 4.99 2/15/2007 16:44 ROY,WHITING 17593 363 2 1569 4.99 2/16/2007 1:47 ROY,WHITING 17599 364 2 2606 4.99 2/19/2007 5:19 BENJAMIN,VARNEY 17600 364 2 2857 4.99 2/19/2007 21:43 BENJAMIN,VARNEY Results Abridged payment_id customer_id staff_id rental_id amount payment_date customer_name 17512 343 2 1547 4.99 2/16/2007 0:10 Douglas,Graf 17520 344 2 1475 4.99 2/15/2007 19:36 Henry,Billingsley 17525 345 2 2766 4.99 2/19/2007 16:13 Carl,Artis 17552 352 2 3331 4.99 2/21/2007 8:06 Albert,Crouse 17575 359 2 1329 4.99 2/15/2007 9:53 Willie,Markham 17583 361 2 2353 4.99 2/18/2007 11:21 Lawrence,Lawton 17592 363 2 1426 4.99 2/15/2007 16:44 Roy,Whiting 17593 363 2 1569 4.99 2/16/2007 1:47 Roy,Whiting
  11. 11. 10 SELECT public.payment.payment_id, public.payment.customer_id, public.payment.staff_id, public.payment.rental_id, public.payment.amount, to_char(public.payment.payment_date,'dd-month-yyyy') as Payment_date, initcap( public.customer.first_name ||','||public.customer.last_name)as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id; payment_id customer_id staff_id rental_id amount payment_date customer_name 25164 267 2 10048 4.99 30-april -2007 Margie,Wade 25232 274 2 10059 4.99 30-april -2007 Naomi,Jennings 25263 277 2 9669 4.99 30-april -2007 Olga,Jimenez 25330 283 2 9353 4.99 30-april -2007 Felicia,Sutton 25472 294 2 10220 4.99 30-april -2007 Shelly,Watts 25489 295 2 9793 4.99 30-april -2007 Daisy,Bates 25490 295 2 10160 4.99 30-april -2007 Daisy,Bates 25562 301 2 9435 4.99 30-april -2007 Robert,Baughman Results Abridged SELECT public.payment.payment_id, public.payment.customer_id, public.payment.staff_id, public.payment.rental_id, to_char( public.payment.amount,'$999,999,99') as Payment_amount, to_char(public.payment.payment_date,'dd-day-mon-yyyy') as Payment_date, initcap( public.customer.first_name ||','||public.customer.last_name)as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id; payment_id customer_id staff_id rental_id payment_amount payment_date customer_name 25164 267 2 10048 $ 5 30-monday -apr-2007 Margie,Wade 25232 274 2 10059 $ 5 30-monday -apr-2007 Naomi,Jennings 25263 277 2 9669 $ 5 30-monday -apr-2007 Olga,Jimenez 25330 283 2 9353 $ 5 30-monday -apr-2007 Felicia,Sutton 25472 294 2 10220 $ 5 30-monday -apr-2007 Shelly,Watts 25489 295 2 9793 $ 5 30-monday -apr-2007 Daisy,Bates 25490 295 2 10160 $ 5 30-monday -apr-2007 Daisy,Bates
  12. 12. 11 Results Abridged SELECT public.payment.customer_id, to_char(sum( public.payment.amount),'$999,999.99' )as Total_Payment, to_char(max ( public.payment.amount),'$999,999.99')as Highest_Payment, to_char(min( public.payment.amount),'$999,999.99')as Smallest_Payment, to_char(avg ( public.payment.amount),'$999,999.99')as Avg_Payment , initcap( public.customer.first_name ||','||public.customer.last_name)as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id GROUP BY public.payment.customer_id, initcap( public.customer.first_name ||','||public.customer.last_name) order by Customer_Name SELECT public.payment.customer_id, to_char(round (sum(public.payment.amount),2 ), '$999,999.99')as Total_Payment, to_char(round(max ( public.payment.amount),2),'$999,999.99')as Highest_Payment, to_char(round(min( public.payment.amount),2),'$999,999.99')as Smallest_Payment, 25562 301 2 9435 $ 5 30-monday -apr-2007 Robert,Baughman 25609 305 2 9119 $ 5 30-monday -apr-2007 Richard,Mccrary 25621 306 2 9242 $ 5 30-monday -apr-2007 Charles,Kowalski 25622 306 2 9395 $ 5 30-monday -apr-2007 Charles,Kowalski 25742 317 2 9513 $ 5 30-monday -apr-2007 Edward,Baugh customer_id total_payment highest_payment smallest_payment avg_payment customer_name 412 $ 74.83 $ 8.99 $ .99 $ 4.40 Allen,Butterfield 515 $ 110.74 $ 8.99 $ .99 $ 4.26 Andre,Rapp 85 $ 72.79 $ 8.99 $ .99 $ 3.47 Anne,Powell 346 $ 145.70 $ 8.99 $ .99 $ 4.86 Arthur,Simpkins 63 $ 112.75 $ 8.99 $ .99 $ 4.51 Ashley,Richardson 173 $ 111.73 $ 8.99 $ .99 $ 4.14 Audrey,Ray 4 $ 81.78 $ 8.99 $ .99 $ 3.72 Barbara,Jones 438 $ 121.70 $ 8.99 $ .99 $ 4.06 Barry,Lovelace 172 $ 133.70 $ 8.99 $ .99 $ 4.46 Bernice,Willis 199 $ 95.76 $ 8.99 $ .99 $ 3.99 Beth,Franklin 278 $ 71.79 $ 8.99 $ .99 $ 3.42 Billie,Horton 381 $ 99.68 $ 8.99 $ .99 $ 3.12 Bobby,Boudreau
  13. 13. 12 to_char(round(avg ( public.payment.amount),2),'$999,999.99')as Avg_Payment , initcap( public.customer.first_name ||','||public.customer.last_name)as Customer_Name FROM public.payment inner join public.customer on public.customer.customer_id = public.payment.customer_id GROUP BY public.payment.customer_id, initcap( public.customer.first_name ||','||public.customer.last_name) order by Customer_Name Results Abridged customer_id total_payment highest_payment smallest_payment avg_payment customer_name 412 $ 74.83 $ 8.99 $ .99 $ 4.40 Allen,Butterfield 515 $ 110.74 $ 8.99 $ .99 $ 4.26 Andre,Rapp 85 $ 72.79 $ 8.99 $ .99 $ 3.47 Anne,Powell 346 $ 145.70 $ 8.99 $ .99 $ 4.86 Arthur,Simpkins 63 $ 112.75 $ 8.99 $ .99 $ 4.51 Ashley,Richardson 173 $ 111.73 $ 8.99 $ .99 $ 4.14 Audrey,Ray 4 $ 81.78 $ 8.99 $ .99 $ 3.72 Barbara,Jones customer_id total_payment highest_payment smallest_payment avg_payment customer_name 13 $ 131.73 $ 11.99 $ .99 $ 4.88 Karen,Jackson 591 $ 134.73 $ 11.99 $ .99 $ 4.99 Kent,Arsenault 362 $ 140.69 $ 11.99 $ .99 $ 4.54 Nicholas,Barfield 204 $ 134.69 $ 11.99 $ .99 $ 4.34 Rosemary,Schmidt 237 $ 138.69 $ 11.99 $ .99 $ 4.47 Tanya,Gilbert 592 $ 111.71 $ 11.99 $ .99 $ 3.85 Terrance,Roush
  14. 14. 13 195 $ 86.81 $ 11.99 $ .99 $ 4.57 Vanessa,Sims 116 $ 106.74 $ 11.99 $ .99 $ 4.11 Victoria,Gibson customer_id total_payment highest_payment smallest_payment avg_payment customer_name 228 $ 86.75 $ 8.99 $ .00 $ 3.47 Allison,Stanley 175 $ 98.76 $ 7.99 $ .00 $ 4.12 Annette,Olson 457 $ 106.73 $ 10.99 $ .00 $ 3.95 Bill,Gavin 42 $ 111.71 $ 7.99 $ .00 $ 3.85 Carolyn,Perez 269 $ 96.79 $ 9.99 $ .00 $ 4.61 Cassandra,Walters 163 $ 122.71 $ 10.99 $ .00 $ 4.23 Cathy,Spencer 43 $ 89.78 $ 6.99 $ .00 $ 4.08 Christine,Roberts 516 $ 92.76 $ 10.99 $ .00 $ 3.87 Elmer,Noe 107 $ 114.72 $ 7.99 $ .00 $ 4.10 Florence,Woods 155 $ 106.76 $ 8.99 $ .00 $ 4.45 Gail,Knight 53 $ 88.76 $ 7.99 $ .00 $ 3.70 Heather,Morris 15 $ 134.68 $ 8.99 $ .00 $ 4.21 Helen,Harris 560 $ 129.71 $ 9.99 $ .00 $ 4.47 Jordan,Archuleta 354 $ 125.67 $ 8.99 $ .00 $ 3.81 Justin,Ngo 361 $ 89.71 $ 6.99 $ .00 $ 3.09 Lawrence,Lawton 208 $ 86.75 $ 6.99 $ .00 $ 3.47 Lucy,Wheeler 267 $ 142.67 $ 9.99 $ .00 $ 4.32 Margie,Wade 448 $ 127.73 $ 10.99 $ .00 $ 4.73 Miguel,Betancourt
  15. 15. 14 60 $ 88.78 $ 9.98 $ .00 $ 4.04 Mildred,Bailey 576 $ 135.68 $ 8.99 $ .00 $ 4.24 Morris,Mccarter 216 $ 90.78 $ 8.99 $ .00 $ 4.13 Natalie,Meyer 284 $ 108.78 $ 8.99 $ .00 $ 4.94 Sonia,Gregory 75 $ 149.61 $ 9.99 $ .00 $ 3.84 Tammy,Sanders
  16. 16. 15
  17. 17. 16 customer_name total_payment highest_payment smallest_payment avg_payment rental_history Allen,Butterfield 74.83 8.99 0.99 4.4 Remember Diary-2.99, Campus Remember-2.99, Speed Suit-5.99, Casablanca Super-4.99, Connection Microcosmos-3.99, Candidate Perdition-6.99, Truman Crazy-4.99, Range Moonwalker-4.99, Whisperer Giant-8.99, Hollywood Anonymous-0.99, Lawrence Love-0.99, Moulin Wake-0.99, King Evolution-8.99, Pickup Driving-8.99, Greedy Roots- 0.99, Truman Crazy-4.99, Mulan Moon-0.99 Andre,Rapp 110.74 8.99 0.99 4.26 Devil Desire-4.99, Fargo Gandhi-5.99, Games Bowfinger-4.99, Forrester Comancheros-4.99, Roman Punk-0.99, Summer Scarface-3.99, Rouge Squad-0.99, Comforts Rush-3.99, Scarface Bang-4.99, Mallrats United-3.99, Orient Closer-6.99, Spiking Element-2.99, Panther Reds-8.99, Wanda Chamber-5.99, Lies Treatment-4.99, Congeniality Quest-3.99, Grit Clockwork-0.99, Scorpion Apollo-4.99, Rocketeer Mother- 0.99, Destiny Saturday-6.99, Gilmore Boiled-0.99, Orange Grapes-2.99, Dangerous Uptown-4.99, Intrigue Worst-3.99, October Submarine-4.99, Dude Blindness-4.99 Anne,Powell 72.79 8.99 0.99 3.47 Mulan Moon-1.99, Weekend Personal-5.99, Homeward Cider-0.99, Confidential Interview-4.99, Brotherhood Blanket-1.99, Tomorrow Hustler-3.99, Dying Maker-4.99, Highball Potter-0.99, Dawn Pond-8.99, Shootist Superfly-0.99, Zorro Ark-4.99, Trouble Date-3.99, Swarm Gold-0.99, Armageddon Lost-0.99, Smile Earring-2.99, Timberland Sky-4.99, Everyone Craft-0.99, Earth Vision-0.99, Fool Mockingbird-7.99, Haunted Antitrust-4.99, Hanky October-2.99 Arthur,Simpkins 145.7 8.99 0.99 4.86 Jason Trap-5.99, Tramp Others-2.99, Strictly Scarface-2.99, French Holiday-5.99, Seabiscuit Punk-3.99, Chill Luck-0.99, Human Graffiti-4.99, Divine Resurrection-4.99, Liberty Magnificent-2.99, Camelot Vacation-5.99, Ice Crossing-2.99, Lesson Cleopatra-0.99, Garden Island-8.99, Apache Divine-5.99, Grease Youth-0.99, Werewolf Lola-4.99, League Hellfighters-8.99, Pity Bound-4.99, Fidelity Devil-4.99, Attraction Newton-4.99, Eyes Driving-2.99, Magnificent Chitty-8.99, Opus Ice-6.99, Ali Forever-5.99, Fish Opus-6.99, Borrowers Bedazzled-0.99, Drifter Commandments-8.99, Chasing Fight-4.99, Remember Diary-4.99, Desire Alien-2.99 Ashley,Richardson 112.75 8.99 0.99 4.51 Earth Vision-0.99, Casper Dragonfly-6.99, Fargo Gandhi-4.99, Ferris Mother-2.99, Monterey Labyrinth-0.99, Shawshank Bubble-7.99, Gun Bonnie-0.99, Breakfast Goldfinger-8.99, Chicken Hellfighters-3.99, Moulin Wake-5.99, Bill Others-2.99, Hustler Party-8.99, Scalawag Duck-4.99, Scorpion Apollo-6.99, Graceland Dynamite-4.99, Lies Treatment-4.99, Goldmine Tycoon-3.99, Birds Perdition-8.99, Show Lord-5.99, Necklace Outbreak-0.99, Baby Hall-4.99, Loathing Legally-3.99, Hours Rage-0.99, Notorious Reunion-2.99, Fantasy Troopers-0.99 Audrey,Ray 111.73 8.99 0.99 4.14 Barbarella Streetcar-2.99, Secret Groundhog-4.99, Tootsie Pilot-2.99, Ridgemont Submarine-0.99, Innocent Usual-4.99, Snatch Slipper-5.99, Others Soup- 2.99 , Show Lord-6.99, Closer Bang-4.99, Cider Desire-2.99, Packer Madigan-0.99, Intentions Empire-8.99, Manchurian Curtain-2.99, Goldfinger Sensibility- 0.99, Hyde Doctor-7.99, Finding Anaconda-2.99, Strictly Scarface-4.99, Uprising Uptown-2.99, Papi Necklace-2.99, Forward Temple-3.99, Suit Walls-4.99, Crow Grease-0.99, Half Outfield-2.99, Cause Date-4.99, Flash Wars-8.99, Casablanca Super-4.99, Spinal Rocky-2.99 Barbara,Jones 81.78 8.99 0.99 3.72 Dogma Family-4.99, Bedazzled Married-0.99, Artist Coldblooded-2.99, Amadeus Holy-0.99, Magic Mallrats-0.99, Idaho Love-5.99, Alamo Videotape-0.99, Vertigo Northwest-2.99, Philadelphia Wife-4.99, Hoosiers Birdcage-2.99, Madigan Dorado-8.99, Annie Identity-1.99, Rollercoaster Bringing-2.99, Stage World-6.99, Deep Crusade-4.99, Married Go-2.99, Reunion Witches-1.99, Wardrobe Phantom-2.99, Shanghai Tycoon-2.99, Arachnophobia Rollercoaster-3.99, Tomorrow Hustler-5.99, Panic Club-5.99 Results Abridged
  18. 18. 17
  19. 19. 18
  20. 20. 19 Data Definition select * from public.rentalhistory
  21. 21. 20 customer_name total_payment highest_payment smallest_payment avg_payment rental_history Vickie,Brewer 100.75 8.99 0.99 4.03 Noon Papi-6.99, Moonwalker Fool-7.99, Monster Spartacus-2.99, Whisperer Giant-7.99, Bride Intrigue-0.99, Storm Happiness-3.99, Trading Pinocchio-4.99, Scissorhands Slums-2.99, Blackout Private-2.99, Casualties Encino-6.99, Homeward Cider-0.99, Hyde Doctor-2.99, Cause Date-4.99, Working Microcosmos-4.99, Town Ark-3.99, Oz Liaisons-2.99, Fish Opus-2.99, Greatest North-2.99, Whisperer Giant-6.99, American Circus-8.99, Divide Monster-2.99, Dragon Squad-0.99, Vanishing Rocky-2.99, Disciple Mother-0.99, Swarm Gold-0.99 Connie,Wallace 95.79 8.99 0.99 4.56 Range Moonwalker-4.99, Velvet Terminator-4.99, Greatest North-2.99, Raging Airplane-8.99, Stampede Disturbing-0.99, Jersey Sassy-7.99, Gorgeous Bingo-2.99, Gables Metropolis-2.99, Rock Instinct-0.99, Roses Treasure-6.99, Darn Forrester-4.99, Hope Tootsie-2.99, Cassidy Wyoming-3.99, Gun Bonnie-3.99, Rugrats Shakespeare-0.99, Monterey Labyrinth-3.99, Sleeping Suspects-4.99, Igby Maker-4.99, World Leathernecks-2.99, Lovely Jingle-7.99, Flamingos Connecticut-8.99 Gwendolyn,May 98.75 8.99 0.99 3.95 None Spiking-3.99, Dorado Notting-4.99, Cruelty Unforgiven-0.99, Greatest North-3.99, Dirty Ace-2.99, Arachnophobia Rollercoaster-3.99, Unforgiven Zoolander-0.99, Idaho Love-2.99, Stepmom Dream-4.99, Wedding Apollo-2.99, Sons Interview-5.99, Telemark Heartbreakers-4.99, Bingo Talented-6.99, Iron Moon-4.99, Love Suicides-0.99, Liaisons Sweet-8.99, Greedy Roots-0.99, Perfect Groove-2.99, Masked Bubble-0.99, Scorpion Apollo-8.99, Wasteland Divine-2.99, Pirates Roxanne- 0.99, Disturbing Scarface-5.99, Goodfellas Salute-5.99, Flying Hook-2.99 Jon,Wiles 85.78 8.99 0.99 3.9 Polish Brooklyn-1.99, Translation Summer-1.99, Disturbing Scarface-2.99, Jawbreaker Brooklyn-0.99, Taxi Kick-0.99, English Bulworth-4.99, Eyes Driving-2.99, Jason Trap-4.99, Samurai Lion-2.99, Center Dinosaur-4.99, Blackout Private- 2.99, Eagles Panky-4.99, Pacific Amistad-1.99, Bringing Hysterical-2.99, Panky Submarine-8.99, Dinosaur Secretary-2.99, Pelican Comforts-6.99, Magic Mallrats-4.99, Yentl Idaho-4.99, Drifter Commandments-4.99, Vampire Whale-5.99, Neighbors Charade-2.99 Brandy,Graves 94.77 8.99 0.99 4.12 Valley Packer-0.99, Deer Virginian-2.99, Purple Movie-2.99, Confessions Maguire-4.99, Human Graffiti-3.99, Driver Annie-5.99, Peak Forever-4.99, Rage Games-4.99, Strangelove Desire-4.99, Island Exorcist-2.99, Life Twisted-3.99, Goodfellas Salute- 4.99, Horn Working-2.99, Sweethearts Suspects-0.99, Lola Agent-4.99, Secret Groundhog-4.99, Wedding Apollo-5.99, Louisiana Harry-2.99, Sleuth Orient-0.99, Amadeus Holy-1.99, Driving Polish-4.99, Spice Sorority-8.99, Cupboard Sinners- 5.99 Results Abridged
  22. 22. 21 CREATE TABLE rentalhistorymax ( customer_id integer, customer_name text, total_payment numeric, highest_payment numeric, smallest_payment numeric, avg_payment numeric, rental_history text ) WITH ( OIDS=FALSE ); ALTER TABLE rentalhistory OWNER TO postgres; Insert into rentalhistorymax(customer_id,Customer_Name, Total_Payment,Highest_Payment,Smallest_Payment,Avg_Payment, Rental_History) SELECT customer.customer_id, customer.first_name||','||customer.last_name As Customer_Name, round (sum(public.payment.amount),2 )as Total_Payment, round(max ( public.payment.amount),2)as Highest_Payment, round(min( public.payment.amount),2)as Smallest_Payment, round(avg ( public.payment.amount),2)as Avg_Payment , group_concat ( cast (public.film.title as varchar) || '-'||round(payment.amount,2)) AS Rental_History FROM public.payment inner join public.rental on public.payment.rental_id = public.rental.rental_id inner join public.inventory on public.inventory.inventory_id = public.rental.inventory_id inner join public.film on public.film.film_id = public.inventory.film_id inner join public.customer on public.customer.customer_id = public.payment.customer_id GROUP BY customer.customer_id having round(max ( public.payment.amount),2)= (select round(max ( public.payment.amount),2) from public.payment) select * from rentalhistorymax
  23. 23. 22 customer_id customer_name total_payment highest_payment smallest_payment avg_payment rental_history 13 Karen,Jackson 131.73 11.99 0.99 4.88 Deceiver Betrayed-2.99, Loser Hustler-4.99, South Wait-2.99, Chance Resurrection-8.99, Baby Hall-4.99, Downhill Enough-0.99, Jeopardy Encino-5.99, Day Unfaithful-7.99, Bowfinger Gables-4.99, Frogmen Breaking-0.99, Gilmore Boiled-0.99, Mission Zoolander-9.99, Lover Truman-7.99, Calendar Gunfight-4.99, Berets Agent-2.99, Past Suicides-8.99, Trouble Date-2.99, Pirates Roxanne-0.99, Arizona Bang-2.99, Stock Glass-2.99, Enough Raging-2.99, Scorpion Apollo-11.99, Sunrise League-9.99, Spirit Flintstones-0.99, Blade Polish-0.99, Identity Lover-7.99, Garden Island-4.99 195 Vanessa,Sims 86.81 11.99 0.99 4.57 Coma Head-4.99, Forrest Sons-7.99, Hope Tootsie-2.99, Greedy Roots-0.99, Outfield Massacre-0.99, Storm Happiness-0.99, Driving Polish-7.99, Scorpion Apollo-11.99, Durham Panky-6.99, Flatliners Killer-2.99, Chance Resurrection-4.99, Hills Neighbors-0.99, Paycheck Wait-4.99, Creatures Shakespeare-2.99, Earring Instinct-4.99, Horror Reign-0.99, Closer Bang-6.99, Bright Encounters-5.99, Interview Liaisons-4.99 362 Nicholas,Barfield 140.69 11.99 0.99 4.54 Tomorrow Hustler-2.99, Gone Trouble-2.99, Story Side-2.99, Halloween Nuts-2.99, Giant Troopers-2.99, Gangs Pride-3.99, Whale Bikini-4.99, Zorro Ark-6.99, Dangerous Uptown-6.99, Sweethearts Suspects-6.99, Shakespeare Saddle-2.99, President Bang- 4.99, Element Freddy-5.99, Sting Personal-11.99, Gleaming Jawbreaker-4.99, Chariots Conspiracy-2.99, Champion Flatliners-8.99, Haunting Pianist-4.99, Joon Northwest-1.99, Exorcist Sting-5.99, Massacre Usual-4.99, Bird Independence-4.99, Apocalypse Flamingos-4.99, Loathing Legally-1.99, Charade Duffel-2.99, Watch Tracy-2.99, Dancing Fever-2.99, Falcon Volume-4.99, Soup Wisdom-0.99, Wrong Behavior-2.99, Mummy Creatures-4.99 204 Rosemary,Schmidt 134.69 11.99 0.99 4.34 Scissorhands Slums-2.99, Kiss Glory-7.99, Bulworth Commandments-4.99, Smile Earring-7.99, Hyde Doctor-2.99, Confessions Maguire-4.99, Maker Gables-5.99, Agent Truman-7.99, Chainsaw Uptown-0.99, Clue Grail-6.99, Spirit Flintstones-0.99, Dogma Family-4.99, Braveheart Human-2.99, Destiny Saturday-4.99, Rugrats Shakespeare-0.99, Trip Newton-4.99, Trap Guys-11.99, Runaway Tenenbaums-0.99, Sabrina Midnight-4.99, Lion Uncut-0.99, Amistad Midsummer-2.99, Grinch Massage-4.99, Madison Trap-2.99, Language Cowboy-0.99, Cat Coneheads-6.99, Shock Cabin-2.99, Prejudice Oleander-4.99, Arabia Dogma-0.99, Arachnophobia Rollercoaster-5.99, Undefeated Dalmations-4.99, Analyze Hoosiers-2.99 591 Kent,Arsenault 134.73 11.99 0.99 4.99 Packer Madigan-0.99, Jacket Frisco-2.99, Brooklyn Desert-4.99, Mermaid Insects-4.99, Tycoon Gathering-5.99, Slacker Liaisons-4.99, Peak Forever-4.99, Details Packer-5.99, Raging Airplane-5.99, Beverly Outlaw-2.99, Dinosaur Secretary-3.99, Wonderland Christmas- 9.99, Roman Punk-0.99, Mine Titans-11.99, Crusade Honey-6.99, Inch Jet-5.99, Connecticut Tramp-6.99, Cat Coneheads-8.99, Operation Operation-2.99, Telemark Heartbreakers-4.99, Groove Fiction-3.99, Streak Ridgemont-0.99, Harper Dying-4.99, Gunfighter Mussolini- 3.99, Slacker Liaisons-5.99, Pirates Roxanne-4.99, Blade Polish-0.99
  24. 24. 23 116 Victoria,Gibson 106.74 11.99 0.99 4.11 Feud Frogmen-0.99, Love Suicides-0.99, Pelican Comforts-4.99, Hanging Deep-4.99, Sunrise League-4.99, Flying Hook-3.99, Slums Duck-1.99, Soup Wisdom-1.99, Whisperer Giant-4.99, Cranes Reservoir-2.99, Flamingos Connecticut-7.99, Mosquito Armageddon-0.99, Earring Instinct-0.99, Haunted Antitrust-6.99, Flintstones Happiness-11.99, Lucky Flying-2.99, Super Wyoming-6.99, Forrest Sons-2.99, Alamo Videotape-0.99, Vampire Whale-4.99, Metropolis Coma-2.99, Finding Anaconda-4.99, Dynamite Tarzan-0.99, Lover Truman- 5.99, Meet Chocolate-6.99, Gables Metropolis-3.99 237 Tanya,Gilbert 138.69 11.99 0.99 4.47 Minority Kiss-0.99, World Leathernecks-0.99, Chance Resurrection-4.99, Noon Papi-2.99, Holy Tadpole-2.99, Igby Maker-4.99, Ties Hunger-11.99, Detective Vision-5.99, Lights Deer-0.99, Paycheck Wait-6.99, Feathers Metal-6.99, Hanover Galaxy-6.99, Rider Caddyshack-3.99, Hunchback Impossible-8.99, Bedazzled Married-0.99, Dragon Squad-1.99, Tequila Past- 4.99, Newsies Story-4.99, Half Outfield-2.99, Slums Duck-3.99, Wyoming Storm-4.99, Super Wyoming-8.99, Won Dares-2.99, Island Exorcist-2.99, Bingo Talented-6.99, Minority Kiss-3.99, Freddy Storm-5.99, Monsoon Cause-4.99, Ridgemont Submarine-1.99, Bedazzled Married-0.99, Color Philadelphia-2.99 592 Terrance,Roush 111.71 11.99 0.99 3.85 Truman Crazy-6.99, Fatal Haunted-5.99, Arizona Bang-2.99, Music Boondock-0.99, Salute Apollo-7.99, Tramp Others-0.99, Bringing Hysterical-2.99, Cincinatti Whisperer-8.99, Slums Duck-0.99, Deceiver Betrayed-0.99, Alaska Phantom-1.99, Warlock Werewolf-2.99, Stone Fire-3.99, Crusade Honey-2.99, Midsummer Groundhog-11.99, Feud Frogmen-1.99, Pelican Comforts-9.99, Tootsie Pilot-0.99, Circus Youth-2.99, Groove Fiction-0.99, Armageddon Lost-0.99, Candidate Perdition-3.99, Peak Forever-4.99, Trojan Tomorrow-2.99, Annie Identity-0.99, Shawshank Bubble-4.99, Effect Gladiator-3.99, Videotape Arsenic-6.99, Kick Savannah-0.99
  25. 25. 24 create or replace view rentakhistoryavg as SELECT customer.customer_id, customer.first_name||','||customer.last_name As Customer_Name, round (sum(public.payment.amount),2 )as Total_Payment, round(max ( public.payment.amount),2)as Highest_Payment, round(min( public.payment.amount),2)as Smallest_Payment, round(avg ( public.payment.amount),2)as Avg_Payment , group_concat ( cast (public.film.title as varchar) || '-'||round(payment.amount,2)) AS Rental_History FROM public.payment inner join public.rental on public.payment.rental_id = public.rental.rental_id inner join public.inventory on public.inventory.inventory_id = public.rental.inventory_id inner join public.film on public.film.film_id = public.inventory.film_id inner join public.customer on public.customer.customer_id = public.payment.customer_id GROUP BY customer.customer_id having round(avg ( public.payment.amount),2)= (select round(avg ( public.payment.amount),2) from public.payment) select * from rentakhistoryavg
  26. 26. 25 customer_id customer_name total_payment highest_payment smallest_payment avg_payment rental_history 109 Edna,West 79.81 7.99 0.99 4.2 Sweet Brotherhood-2.99, Shakespeare Saddle-3.99, Hope Tootsie-6.99, Horror Reign-5.99, Express Lonely-5.99, Wolves Desire-0.99, Random Go-3.99, Shrunk Divine-6.99, Heaven Freedom-3.99, Wife Turn-7.99, Hyde Doctor-2.99, Brannigan Sunrise-4.99, Island Exorcist- 2.99, Cabin Flash-2.99, Kiss Glory-6.99, Silence Kane-0.99, Sun Confessions-3.99, Dynamite Tarzan-0.99, Atlantis Cause-2.99 304 David,Royal 79.81 8.99 0.99 4.2 Moon Bunch-0.99, Matrix Snowman-4.99, Nemo Campus-5.99, Wasteland Divine-3.99, Mockingbird Hollywood-0.99, Slums Duck-4.99, Fury Murder-4.99, Ridgemont Submarine- 6.99, Reign Gentlemen-8.99, Vanished Garden-2.99, Satisfaction Confidential-4.99, Groove Fiction-3.99, Sun Confessions-0.99, Splash Gump-0.99, Bikini Borrowers-4.99, Million Ace- 4.99, Train Bunch-4.99, Wolves Desire-0.99, Undefeated Dalmations-6.99 517 Brad,Mccurdy 100.76 8.99 0.99 4.2 King Evolution-4.99, Dogma Family-8.99, Color Philadelphia-4.99, Manchurian Curtain- 2.99, Shootist Superfly-0.99, Paycheck Wait-4.99, Forrester Comancheros-4.99, Vacation Boondock-3.99, Language Cowboy-0.99, Tramp Others-0.99, Trouble Date-4.99, Groundhog Uncut-5.99, Lock Rear-2.99, Candles Grapes-4.99, Secret Groundhog-4.99, Wanda Chamber-4.99, Greedy Roots-0.99, Greatest North-2.99, Cincinatti Whisperer-7.99, Suspects Quills-5.99, Wife Turn-4.99, Sleuth Orient-0.99, Operation Operation-3.99, Paris Weekend- 4.99 257 Marsha,Douglas 142.66 7.99 0.99 4.2 Wrath Mile-0.99, Open African-4.99, Flamingos Connecticut-4.99, Illusion Amelie-0.99, Pulp Beverly-6.99, Volcano Texas-1.99, Unbreakable Karate-2.99, Brotherhood Blanket- 5.99, Confused Candles-7.99, Tracy Cider-0.99, Robbery Bright-2.99, Remember Diary- 5.99, Hollywood Anonymous-0.99, Independence Hotel-0.99, Bill Others-2.99, Shepherd Midsummer-0.99, Tomorrow Hustler-6.99, Candles Grapes-4.99, Jason Trap-6.99, Opus Ice- 4.99, Color Philadelphia-5.99, Jet Neighbors-5.99, Trip Newton-4.99, Balloon Homeward- 2.99, Louisiana Harry-1.99, Gentlemen Stage-2.99, Mod Secretary-5.99, Hoosiers Birdcage- 3.99, Rider Caddyshack-2.99, Badman Dawn-4.99, Heartbreakers Bright-4.99, Scarface Bang-6.99, Interview Liaisons-4.99, Hardly Robbers-4.99 572 Sidney,Burleson 100.76 10.99 0.99 4.2 Stranger Strangers-10.99, Dracula Crystal-0.99, Celebrity Horn-0.99, Encounters Curtain- 0.99, Devil Desire-4.99, Japanese Run-2.99, Annie Identity-4.99, Lola Agent-4.99, Packer Madigan-1.99, Evolution Alter-1.99, Arachnophobia Rollercoaster-6.99, Downhill Enough- 5.99, Princess Giant-2.99, Bear Graceland-4.99, Earring Instinct-6.99, Vanishing Rocky- 2.99, Blues Instinct-4.99, Lose Inch-4.99, Hunchback Impossible-6.99, Resurrection Silverado-0.99, Straight Hours-0.99, Peach Innocent-3.99, Gleaming Jawbreaker-5.99, Coma Head-4.99 573 Byron,Box 117.72 10.99 0.99 4.2 Willow Tracy-4.99, Fatal Haunted-5.99, Wrath Mile-1.99, Gosford Donnie-7.99, Homeward
  27. 27. 26 Cider-0.99, Saddle Antitrust-2.99, Alaska Phantom-0.99, Clueless Bucket-5.99, Birdcage Casper-1.99, Anonymous Human-1.99, Closer Bang-6.99, Shepherd Midsummer-0.99, Life Twisted-2.99, Swarm Gold-0.99, Arachnophobia Rollercoaster-2.99, Beauty Grease-4.99, Goldmine Tycoon-0.99, Smoking Barbarella-0.99, Loathing Legally-2.99, Alien Center-5.99, Midsummer Groundhog-9.99, Fargo Gandhi-2.99, Human Graffiti-7.99, Sleepless Monsoon- 4.99, Saturday Lambs-10.99, Undefeated Dalmations-4.99, Gaslight Crusade-2.99, Mockingbird Hollywood-5.99
  28. 28. 27
  29. 29. 28
  30. 30. 29
  31. 31. 30
  32. 32. 31
  33. 33. 32 Table Creations
  34. 34. 33
  35. 35. 34
  36. 36. 35
  37. 37. 36
  38. 38. 37 Object Verifications
  39. 39. 38
  40. 40. 39 Table Population Statements
  41. 41. 40 Data Verification
  42. 42. 41
  43. 43. 42
  44. 44. 43
  45. 45. 44
  46. 46. 45
  47. 47. 46 Database Security-Audits
  48. 48. 47 Audit Validation User: public
  49. 49. 48
  50. 50. 49
  51. 51. 50
  52. 52. 51
  53. 53. 52 Objects Verification
  54. 54. 53
  55. 55. 54 Each of the tables created will contain the additional information related to thetriggers used for data auditing compared to the original object verification.
  56. 56. 55 Database Backup and Revision Due to a system error I had to uninstall postgres server and reinstall the server. As result I had to back up the entire library database using PgAdmin 111 application which the task easier to conduct
  57. 57. 56
  58. 58. 57 Once the database has been restored, I continued working on the database development and made few adjustments. A new column catalog_id was added to referenced back to BookCatalog table. This will make it easier to know the number of books available in the inventory by catalog_id number. Library_ID column was added to BookCatalog table. This will make it easier for each library to maintain their own catalog. Finally the RentalsCheckout table a new column catalog_id was added to aid employees determine the type of books processed.
  59. 59. 58
  60. 60. 59
  61. 61. 60 Indexes Metadata
  62. 62. 61 Constraints metadata
  63. 63. 62
  64. 64. 63 Triggers Metadata
  65. 65. 64
  66. 66. 65
  67. 67. 66 Sybase IQ 15.4
  68. 68. 67 Database Creation
  69. 69. 68
  70. 70. 69
  71. 71. 70 Database Verification
  72. 72. 71 Library Database
  73. 73. 72 Objects Creation
  74. 74. 73
  75. 75. 74
  76. 76. 75 Objects Verification In the following demonstrations I would use Sybase Central to view each objects definition and later use the system stored procedure to display the same information in non-graphical format using Sybase interactive SQL
  77. 77. 76
  78. 78. 77 In the following demonstration below I would use the system stored procedure to retrieve the table structures relating to specific tables in the database which is equivalent to Oracle select * from user_tables where table_name = customer ,SQL Server sp_hep procedure like Exec sp_help ‘customer’,PostgreSQL d table_name+, Oracle and MYSQL Describe Object_Name for examples
  79. 79. 78
  80. 80. 79
  81. 81. 80 Data Loading
  82. 82. 81
  83. 83. 82
  84. 84. 83 Database Revision Few changes were made to the database.
  85. 85. 84
  86. 86. 85
  87. 87. 86 Data Validation
  88. 88. 87
  89. 89. 88
  90. 90. 89 Data Manipulation
  91. 91. 90
  92. 92. 91
  93. 93. 92
  94. 94. 93
  95. 95. 94 Functions and Stored Procedures
  96. 96. 95
  97. 97. 96
  98. 98. 97
  99. 99. 98
  100. 100. 99 DBA Tasks
  101. 101. 100
  102. 102. 101
  103. 103. 102
  104. 104. 103
  105. 105. 104
  106. 106. 105
  107. 107. 106 Database Diagram
  108. 108. 107
  109. 109. 108
  110. 110. 109
  111. 111. 110

×