Database Fundamentals

Slides:



Advertisements
Similar presentations
Chapter 10: Designing Databases
Advertisements

Accounting System Design
Client/Server Databases and the Oracle 10g Relational Database
The Relational Database Model:
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Databases and Database Management Systems
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Database Lecture # 1 By Ubaid Ullah.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
Data-mining & Data As we used Excel that has capability to analyze data to find important information, the data-mining helps us to extract information.
SQL Structured Query Language Programming Course.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Relational Database. Database Management System (DBMS)
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Databases Chapter Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Object storage and object interoperability
Microsoft Access CS 110 Fall Entity Relationship Model Entities Entities Principal data object about which information is to be collectedPrincipal.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
SQL Basics Review Reviewing what we’ve learned so far…….
Fundamental of Database Systems
Database Design Chapters 17 and 18.
Databases and DBMSs Todd S. Bacastow January
Fundamentals of DBMS Notes-1.
Logical Database Design and the Rational Model
Database Development Lifecycle
Implementing an REA Model in a Relational Database
“Introduction To Database and SQL”
Client/Server Databases and the Oracle 10g Relational Database
Chapter 1: Introduction
Chapter 1: Introduction
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Information Systems Today: Managing in the Digital World
DESIGNING DATABASE APPLICATIONS
Chapter 9 Database Systems
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
What is an attribute? How is it related to an entity?
Database Management Systems (DBMS)
Lecture 2 The Relational Model
Chapter 4 Relational Databases
Databases and Information Management
Chapter 9 Designing Databases
Entity Relationships and Normalization
“Introduction To Database and SQL”
Basic Concepts in Data Management
Accounting System Design
MANAGING DATA RESOURCES
ERD’s REVIEW DBS201.
Chapter 8 Working with Databases and MySQL
LECTURE 34: Database Introduction
MANAGING DATA RESOURCES
Database Design Chapters 17 and 18.
Accounting System Design
Databases and Information Management
SQL-1 Week 8-9.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Accounting Information Systems 9th Edition
Database Design Hacettepe University
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
logical design for relational database
Database Design: Relational Model
Chapter 3 Database Management
Session - 6 Sequence - 1 SQL: The Structured Query Language:
DATABASE Purpose of database
LECTURE 33: Database Introduction
INTRODUCTION A Database system is basically a computer based record keeping system. The collection of data, usually referred to as the database, contains.
Presentation transcript:

Database Fundamentals ITE 370 11/19/2018

Databases A database is a collection of related data which is organized to meet user needs We assume a relational database model Relational database design objectives: Eliminate redundant data Be able to locate individual records quickly Make enhancements to the database easy to implement Keep the database easy to maintain Theme for this class – Database Programming VISUAL EVENT-DRIVEN OBJECT-ORIENTED CONNECT TO DATABASE We will learn techniques to connect through a visual, OO, event-driven program 11/19/2018

Entities An entity is a class of objects, such as people, products, or services, about which we collect data. For example, Students at the university. Employees at a business. Sales transactions in a retail business. Inventory of parts in a warehouse. 11/19/2018

Relations and Tables A relation is a set of columns and rows collected in a table-like structure that represents a single entity made up of related data A table is a physical implementation of a relation in a DBMS A relation does not have to be a physical entity – It can be the results from a query. Relations can be NON-normalized 11/19/2018

Attributes and Columns An attribute is a characteristic of an entity Examples of attributes Names, addresses, phone numbers of people. Titles, salaries, job descriptions of employees. Time, date, customer id, sales person id in a sales transaction. Part number, Cost, In-stock-quantity of inventory of parts. A column, or field, is a physical implementation of an attribute 11/19/2018

Tuples and Rows A tuple is set of data whose values make up an instance of each attribute defined for that relation A tuple is implemented physically as a row in a table, or a record 11/19/2018

Summary of basic terms In relational model, or the logical model Relations consist of a set of tuples that define a set of specific attributes for one instance of the entity In the physical implementation of a database Relations are implemented as tables Attributes are columns or fields Tuples are rows or records 11/19/2018

Keys Keys are the attributes that are used to uniquely identify each instance of an entity, i.e. each row in a table The uniqueness can naturally occur like Social Security numbers or can be created by the database management system. Student Id Employee number Part number Social Security Number The trend is towards making primary keys unique for the entire database, not just within a specific table 11/19/2018

Relationships Relationships are established between entities. They provide the link between tables. These relationships are usually connected by keys (sometimes called secondary keys). In both entities, the keys contain the unique data that relates the two tables together. Usually, the (primary) key field in one table is linked to a foreign key in another table. 11/19/2018

Relationships Relationships may be one-to-one one-to-many many-to-many (requires intersection table in physical implementation) 11/19/2018

Database Review Question Athletes at the Olympics play for themselves, but they also compete for their country. An athlete belongs to a country – this is their nationality. A country can have more than one athlete representing it, of course, but an athlete can only compete for one country at the Olympics. If the athlete entity is implemented as a database table, and the country entity is implemented as another, then which table(s) contain(s) the foreign key to represent the relationship between the athletes and countries? Athlete - Both Athlete and Country Country - Either Athlete or Country Cardinality defines the numeric relationships between occurrences of the entities on either end of the relationship line. 11/19/2018

Bus Schedule Database from an ITE Project Course Stop – Physical Location of where the bus stops (stops can be on multiple routes or even multiple times on the same route) StopOnRoute – Bridge Entity between Stop and Route due to M:N relationship Route – Sequence of Stops to Pick Up and Drop Off Passengers for a single Bus and Driver (Foreign Keys are in the Main Table) RouteStart – Allows routes to run multiple times during the day (created through normalization to avoid redundant data in Route table) 11/19/2018

Normalization Rules of normalization are established to organize a relational database so that Data integrity is preserved Data redundancy is minimized Practical limitations sometimes require that data in a database be non-normalized 11/19/2018

Relation (not a physical table) result from a Query Non-normalized Redundant Data Can lose data integrity 11/19/2018

Brief Introduction to SQL SQL stands for Structured Query Language, a widely-supported database language that has established standards SQL is a 4GL? Specifies the “what” rather than the “how” In SQL, we will write queries. A query is a formalized instruction to a database to either return a set of records or perform a specific action on a set of records as specified in the query 11/19/2018

Types of SQL statements There are 3 types of SQL statements Data Definition Language (DDL) Data Control Language (DCL) Data Manipulation Language (DML) We will almost exclusively focus on the DML—statements used to view, add, modify, or delete data stored in a relational database We will deal with DML – Data Manipulation Language – Add, Update, Delete (Manipulate) 11/19/2018

How are SQL statements executed? Four ways. We will focus on two: Direct invocation From SQL-Server Query Analyzer From MS-Access in Query Design Call Level Interface (CLI) Applications invoke SQL statements at run-time SQL statements not precompiled Executed directly by RDMBS Where do we put the SQL Statements? In Database In Other Application 11/19/2018

Direct Invocation via SQL-Server Query Analyzer 11/19/2018

A CLI-style call in Visual Basic In VB: strSQL = “Select LName, FName From Emp Where Title = ‘Clerk’;” adoEmp.RecordSource = strSQL adoEmp.CommandType = adCmdText adoEmp.Refresh Or, another example adoEmp.Open “SELECT * From Emp “ _ & “Where Title = ‘” & cboTitle.Text & “’” SQL can be assigned as a property of an object Embedded SQL in Visual Basic (or other languages) We do not want users to work directly with the database We need Security We Need “EASY” for User (GUI) Some queries we will write in code, in other cases we will write them in stored procedures that we can call from our application 11/19/2018