3 / 12 chapter databases mis105 irfan ahmed ilyas
Post on 21-Dec-2015
227 views
TRANSCRIPT
![Page 1: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/1.jpg)
3 / 123 / 123 / 123 / 12CH
AP
TE
R
Databases
MIS105
Irfan Ahmed Ilyas
![Page 2: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/2.jpg)
CE 2© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
More topics on Databases
• Databases Advantages
• Types of Databases
• Databases Uses and Issues
• Writing Queries in DBMS
![Page 3: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/3.jpg)
CE 3© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Databases Advantages
– Sharing information• One department to another
– Security• Password to access
– Less data redundancy• Excess storage reduced
– Data integrity• Consistent data
![Page 4: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/4.jpg)
CE 4© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Types of Databases
• Individual database– Integrated files used by one person
• Shared database– Common operational– Common user
• Distributed database• Proprietary database• Web database
![Page 5: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/5.jpg)
CE 5© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Database Uses and Issues
• Strategic uses
– Data warehouse
– Data mining
• Many databases used everyday
– Business directories
– Business statistical information
– Web search databases
• Security issues
![Page 6: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/6.jpg)
CE 6© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Writing Queries in DBMS
1. What are Queries?
2. Available Query Types• Data Manipulation Queries• Data Definition Queries
3. Creating Queries in Access1. QBE (Query By Example)2. SQL (Structured Query Language)
![Page 7: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/7.jpg)
CE 7© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
… Competencies
4. Working with SELECT Queries1. Using Single Table
2. Multiple table
3. Parametric (Runtime Criteria) Query
![Page 8: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/8.jpg)
CE 8© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
What Are Queries?
• Queries help the user to select information from tables for a specific purpose
• Queries can– Show the selected fields– Show selected records from one or multiple table– Update selected records– Delete selected records– Make new tables– Append records in an existing table
![Page 9: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/9.jpg)
CE 9© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Available Query Types
• Data Manipulation Queries• SELECT Queries
– Show database records fulfilling some criteria
• UPDATE Queries– Modify database records (fulfilling some criteria)
• APPEND Queries– Add more database records to some table
• DELETE Queries– Delete some database records fulfilling some criteria
• Data Definition Queries• CREATE TABLE Queries
– Create new table\field types inside the database
![Page 10: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/10.jpg)
CE 10© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Creating Queries in Access
• QBE (Query By Example) Approach– Allows a visual Query creation
– Query Grid allows to• select records from the required tables\
other queries• select only the desired field of the
records• sort the result on the basis of some field
values• specify record selection criteria
![Page 11: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/11.jpg)
CE 11© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
An Example Query in a QBE Grid
Query showing Saudi Faculty Members
![Page 12: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/12.jpg)
CE 12© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
…Creating Queries in Access
• Using SQL (Structured Query Language) Statements– A standard way of creating Queries – Applicable to all existing DBMS (relational)– A set of statements is used to create
Queries
In Access: View\ SQL View is used to write Queries directly in SQL
![Page 13: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/13.jpg)
CE 13© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
…Creating Queries in Access
• Example SQL StatementsSELECT Queries
– UPDATE Queries
SELECT <field name(s)>
FROM <table name(s)>
WHERE <condition(s)>;
UPDATE <table name(s)> SET <field name= value>
WHERE <condition(s)>;
![Page 14: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/14.jpg)
CE 14© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
An Example Query in SQL View
Query showing Saudi Faculty Members in SQL View
![Page 15: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/15.jpg)
CE 15© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Working with SELECT Queries• SELECT Queries show
database records fulfilling some criteria
• Query Criteria are defined on one or more field values
• Compound criteria expressions can be made (by using AND/ OR)
Logical Operators for building Query Criteria
Example Criteria Expressions
![Page 16: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/16.jpg)
CE 16© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
Working with SELECT Queries
Compound Criteria Queries (AND \ OR)
![Page 17: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/17.jpg)
CE 17© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
1. SELECT Queries: Single Table
• Query only needs information from a single table
• Example– Faculty information is needed for Saudi Faculty
Query Result
A SELECT Query with single table
![Page 18: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/18.jpg)
CE 18© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
2. SELECT Queries: Multiple Table• Query needs information from more than one tables• All tables used must be properly related to each other
(using PK\ FK links)• Example
– Faculty information including their department name is needed
Query Result
SELECT Query with multiple tables
![Page 19: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/19.jpg)
CE 19© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
….SELECT Queries: Multiple Table• Effect of using tables without any relationships
Employee TableJobs Table
Query Result: Cross Product of Records
Multiple Table Query having no relationship
![Page 20: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/20.jpg)
CE 20© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111
3. SELECT Queries: Parametric
• When?– Criteria value is flexible to change during Query runtime
• Example– Faculty information who join the university in a given value
of Year (given during runtime)
Query ResultVariable Value
![Page 21: 3 / 12 CHAPTER Databases MIS105 Irfan Ahmed Ilyas](https://reader036.vdocuments.net/reader036/viewer/2022062407/56649d625503460f94a44c20/html5/thumbnails/21.jpg)
CE 21© The McGraw-Hill Companies, Inc. 2000
Ch 11
1111