220 likes | 242 Views
Overview of Databases. Content. Databases Example: Access Structure Query language (SQL). What is a Database?. Database is an organized collection of related data, typically stored on disk, and accessible by possibly many concurrent users.
E N D
Content • Databases • Example: Access • Structure Query language (SQL)
What is a Database? • Database is an organized collection of related data, typically stored on disk, and accessible by possibly many concurrent users. • Have programming capability to access and manipulate data • Three traditional types of database: • hierarchical • relational (most prevalent type) • network • New: object-oriented
Database • Example databases: • Oracle • Sybase/Microsoft SQL • IBM’s DB2, IMS and SQL/DS • dBase • Access
Database • Relational database: • It is a tabular database in which the data is defined so that it can reorganized and accessed in a number of different ways. • Tables are used to make it easy to maintain and data
Database • Advantage of relational databases: • easy to create • easy to access • easy to extend • Possible disadvantage • Limited set of content (compared to object oriented databases).
Database • Relational database structure: • set of tables containing data fitted into predefined categories; • each table (relation) contains one or more data categories in columns. • each row contains a unique instance of data for the categories defined by column.
Programming • Database systems also have some programming capability • Often using SQL (see later) • Allows for accessing and manipulating data to form a report or to answer a query.
Access • Relational database • Integrates data from spreadsheet and other database • User friendly • Easy to use (help wizard) • Limited in scale of application (small applications best)
Features of Access • Database Wizard • Simple Query Wizard • Filter by selection • Integration with Form, filter by form • Report output
Relationships in Access • Multiple tables in one database • Matching key fields between table • A key is usually a field with the same name in both tables. • Such key is primary key for one table, foreign key in the other table.
Access : Database Note: tables, queries, forms and reports.
Access: Table Table is where the data is kept
Access: key Need to have a key to link data across tables
Access: Macros and Modules • A macro is a set of one or more actions that each perform a particular operation, such as opening a form or printing a report. • Macros can help to automate common tasks. For example, a macro can run to prints a report when a user clicks a command button. Module • A module is a collection of Visual Basic for Applications declarations and procedures that are stored together as a unit.
Access: Report Predefined report can be generated on demand from data.
Database Programming • Access can use VBA or SQL for programming. • VBA not a standard. • SQL (see later) is used by most database systems.
SQL • SQL: Structured Query Language • It is used to query from and update database. • Systems using SQL: • Oracle • Sybase • Microsoft SQL server • Access
SQL • Standard SQL commands: • Select • Insert • Update • Delete • Create
SQL Example • To find out the ‘Category name’ when ‘Category ID’ equals to 1 SELECT Category name FROM Categories WHERE Category ID=1 Note: ‘Category name’ and ‘Category ID’ are column/field, ‘Categories’ is the table