Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
CIS 2336 Database Concepts
Knowledge is Power
• Data• Information = Processed or
organized data• Knowledge = Internally processed,
organized information
Measures of Data Quality
• Is it accurate?• Is it comprehensive?• Is it accessible?
Database Management Systems (DBMS)• Help ensure:
– data quality– accessibility
Database Models
• Flat file• Hierarchical• Networked• Relational• Object• Object-Relational• Document
Most Current Applications
• Implement the relational model
Relational Db Model
• Data arranged in tables– Each table has a column set that
contains a unique value for every row– Primary key
• Fixed set of columns– These represent entity attributes
• Data from different tables linked by logical relationships– These are called foreign keys
SQL – a Language for Querying a Database• Users access data using SQL
– Industry standard query language
Relational Theory
• Based on relational algebra and relational calculus
• Overarching principle: “reduce data redundancy to increase data integrity”
Structured Query Language
• ANSI 92 standards– Most major products comply with this
and provide extended functionality• ANSI 99 standards
– Extend traditional relational model closer to an object oriented model
Microsoft SQL Server
• ANSI SQL 92 compliant• Transact SQL
– Microsoft’s dialect of SQL– Has extensions to ANSI SQL 92
standard– Extensions are not accessible to all
other rdbms
Architecture of a SQL Server Db Interaction• User action in client application
calls a function in the application that generates a SQL query
• Query is generated in SQL language
Architecture of a SQL Server Db Interaction• Application uses a db access library
to communicate with SQL Server RDBMS– e.g., OLE DB or ODBC or SQL Server
Provider• Db access library translates request
into T-SQL commands
Architecture of a SQL Server Db Interaction• T-SQL commands encapsulated in
Tabular Data Stream (TDS) packets and passed to the db network library
• Client computer network library repackages TDS packets as network packets for transfer to the db server
• Packets transferred to server by network protocol (TCP/IP, e.g.)
Architecture of a SQL Server Db Interaction• Server extracts TDS packets from
network packets• TDS sent to Open Data Services on
the server where T-SQL commands are extracted
Architecture of a SQL Server Db Interaction• ODS sends the query to the SQL
Server relationship engine• SQL Server optimizes and executes
the query, working with the storage engine
• Relational engine creates result set of data and sends it to ODS
Architecture of a SQL Server Db Interaction• ODS creates TDS packets for client
application• Network library wraps TDS packets
in network protocol packets• Network library sends network
packets to client computer
Architecture of a SQL Server Db Interaction• Client network library extracts TDS
packets for database access library• From TDS packets, database
access library creates client compatible result set for client application
• Client application displays result set to end user
Performance Implications
• Client application sends only a database request to the server
• SQL Server sends only the result set to the client computer
• No server resources are used for user interactions
• No server resources used for data display
• No client resources used for query execution or data access
Performance Implications
• Client application design does not depend on what software drives the back end
• Client application does not depend on the network protocol used, thus the client application can be moved to a different network
Database Components (Objects)• Tables are the main db objects• Constraints – to guarantee data integrity
and consistency– Primary key, unique, check, default,
foreign key• Views – complex queries saved on the db
server• Indexes – speed up access to data• User-Defined functions and stored
procedures – save complex processes• Triggers – stored procedures that execute
based on a data event
SQL Server Security Model
• SQL Server login – give a user access to the SQL Server instance
• Database user – give a user access to a database
• Permissions – give a user permission to specific db objects and/or actions
• Roles – place a user into a predefined Server role or DB role
N-Tier Application Development
• Data tier – deals with the actual data the application uses
• Presentation tier – User interaction• Business tier – interacts with the
data tier to process data and then send processed results back to user through the presentation tier
CIS 2336
Database Concepts