Download presentation
Presentation is loading. Please wait.
Published byAugust Robbins Modified over 8 years ago
1
IST 220 Introduction to Databases Course Wrap-up
2
Basic Concepts Data Information Database Database management system (DBMS) Relational DB and RDBMS
3
Database Objects Database objects (as used in MS Access) Tables Queries Select queries Action queries Forms Reports Macros Their purposes
4
Additional Features (in Access) Views Normal view (datasheet, form, report views) Design view Special views (PivotTable view, SQL view) Controls Bound Unbound Properties (sheet)
5
Tables Table structure Row (aka as record) Column (aka field, attribute) Identifying: PK Describing Referencing: FK Data types Domain (or value range) Continuous: check (salary >= 0) Discrete: in (‘Y’, ‘N’)
6
Primary Key A key may consist of one or more attributes Primary key: just one Not null Unique Indexed Candidate key: one or more Unique Not all required (or not null) fields are qualified for a key
7
Foreign Key Referencing to PK in a related table May not reference any other fields Referential integrity A FK may only accept a value that exists in the corresponding PK Dependence: impacts on the proper order to Create related tables Insert data into these tables Delete data from these tables
8
Relationships Each table consists of attributes directly related to one subject (to reduce duplication) Relationships are at the heart in joining tables to generate reports Specified through FK-PK links Possible cardinality ratios include One-to-one One-to-many or many-to-one Many-to-many A conjunction table is needed in keeping track of a many- to-many relationship
9
Joining Tables Equality-joins (btw two directly linked tables) An equality condition is used: FK_value = PK_value Without applying it, leads to all possible combinations (CROSS JOIN) Most of them are invalid Equality-joins (btw two indirectly related tables) Include all tables on the path btw them Applying an equality condition on each PK-FK pair Non-equality joins As btw the book and promotion tables
10
Basic Operations All DBMS’ support the CRUD operations Read (or select): Won’t change data (as Select Queries in Access) Create (or insert) Update Delete Change data (as Action Queries in Access) Others, such as making a table from a query In Access: Make-Table Queries In SQL: create table t_name as (select …)
11
Select The syntax SELECT :select column-wise FROM :data source(s) WHERE :select row-wise GROUP BY :partitioning for total queries HAVING :specifying criteria w.r.t. total values ORDER BY :sort in ascending (default) or descending order :it’s possible to sort by multiple fields Up to six clauses Two of them are mandatory Clauses should appear in the order as shown
12
Create Tables A create table statement defines Names of fields Data types used, with length/precision specs Constraints, defined at Column level Table level Syntax CREATE TABLE t_name ( Field_name type ( length ) in-line_constraint_def, CONSTRAINT c_name c_type ( field(s) ) constraint_def );
13
Insert The syntax INSERT INTO t_name ( field(s) ) :optional VALUES ( value(s) :one for each field listed above ) :or as exists in the table if not specified Examples
14
Update The syntax UPDATE t_name SET :only one SET keyword is needed field = value [, field = value, …] WHERE condition(s) :usually needed Examples
15
Delete The syntax DELETE [FROM] t_name :the FROM keyword may be omitted WHERE condition(s) :usually needed Although DELETE [FROM] t_name will remove all records in the table, the table still exists To remove the table definition, user DROP TABLE statement Examples
16
Macros Objects that can help automate your Access application Design view Action Comments Optionally named May be invoked by clicking a button or when the system starts up A normal form A switchboard form
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.