DBS201: Introduction to Database Design and SQL

Slides:



Advertisements
Similar presentations
Introduction to Databases
Advertisements

Introduction to Structured Query Language (SQL)
Database Systems Chapter 1
1 DBS201: More on SQL Lecture 2. 2 Agenda Review How to create a table How to insert data into a table Terms Lab 2.
Introduction to Structured Query Language (SQL)
File Systems and Databases
Database Management: Getting Data Together Chapter 14.
Concepts of Database Management Sixth Edition
Organizing Data & Information
Introduction to Databases Transparencies
Introduction to Structured Query Language (SQL)
Databases and Database Management Systems
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Database Systems.
Chapter 1 Introduction to Databases
Data at the Core of the Enterprise. Objectives  Define of database systems  Introduce data modeling and SQL  Discuss emerging requirements of database.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Database Systems: Design, Implementation, and Management Ninth Edition
Database Systems Chapter 1
Chapter 1 Database Systems. Good decisions require good information derived from raw facts Data is managed most efficiently when stored in a database.
Introduction to SQL J.-S. Chou Assistant Professor.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
DBS201: Introduction to Database Design
Data at the Core of the Enterprise. Objectives  Define of database systems.  Introduce data modeling and SQL.  Discuss emerging requirements of database.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Database Design - Lecture 1
DBS201: DBA/DBMS Lecture 13.
6-1 DATABASE FUNDAMENTALS Information is everywhere in an organization Information is stored in databases –Database – maintains information about various.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Database Technical Session By: Prof. Adarsh Patel.
Chapter 7: Database Systems Succeeding with Technology: Second Edition.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
311: Management Information Systems Database Systems Chapter 3.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
© 2007 by Prentice Hall 1 Introduction to databases.
1 Chapter 1 Database Systems Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
I Information Systems Technology Ross Malaga 4 "Part I Understanding Information Systems Technology" Copyright © 2005 Prentice Hall, Inc. 4-1 DATABASE.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Lecture # 3 & 4 Chapter # 2 Database System Concepts and Architecture Muhammad Emran Database Systems 1.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 1 DATABASE SYSTEMS Instructor Ms. Arwa Binsaleh.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 1 Database Systems.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
IS 380 Introduction to SQL This lectures covers material from: database textbook chapter 3 Oracle chapter: 3,14,17.
1 Chapter 1 Database Systems Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
©2003 Prentice Hall Business Publishing, Accounting Information Systems, 9/e, Romney/Steinbart 4-1 Relational Databases.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
CSC 351 FUNDAMENTALS OF DATABASE SYSTEMS. LECTURE 1: INTRODUCTION TO DATABASES.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. DATABASE.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 1 Database Systems.
Presentation on Database management Submitted To: Prof: Rutvi Sarang Submitted By: Dharmishtha A. Baria Roll:No:1(sem-3)
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
 CONACT UC:  Magnific training   
SQL Basics Review Reviewing what we’ve learned so far…….
Chapter 5 Introduction to SQL.
Chapter 1 Database Systems
Chapter 1 Database Systems
Presentation transcript:

DBS201: Introduction to Database Design and SQL Lecture 1

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

Data vs. Information Data: Information: Unprocessed information i.e. customer, course, employee Building blocks of information Information: Produced by processing data which is related i.e. credit card statement, phone bill, video rental Accurate and timely information is need for decision making Good decision making is key to an organization’s survival

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

File Systems Using a simple business example: A customer orders product from a Retailer Sales Department would take the order information from the customer Sales Department would send a request to the Shipping Department to deliver a product to a customer

File Systems Using a simple business example: The Shipping Department would enter in the information about the customer order and create a shipping document The Shipping Department would print the shipping document and send the products to the Customer

File Systems Possible files: Can anybody see a problem with this? Sales Department: Customer, Product, Sale Shipping Department: Customer, Shipping Document Can anybody see a problem with this? Where would you go to look up the phone number for a customer

Data Redundancy Same data appears in more than one location Results in data inconsistency Data anomalies result when changes to redundant data are not made successfully

Data Anomalies Modification anomalies Insertion anomalies Deletion anomalies

Data Anomalies Modification anomaly Change the address for employee 519 – has to be done for all rows What if this employee address is in another table – has to be done for all tables

Data Anomalies Deletion anomaly Dr. Giddens is not teaching ENG-206 this semester We could lose the hire date if we remove this row to reflect current faculty and their courses

Data Anomalies Insertion anomaly We can record the details of any faculty member who teaches at least one course in 2007 We cannot record the details of a newly hired faculty member who has not yet been assigned to teach any courses

File Systems Programs were written to access data. i.e. to get information about a customer, a program would be written to do just that (and nothing else). Program would go against a specific file (or files, depending on it’s purpose) If other information was needed, another program was written Programmer had to specify exactly how the processing of the data needed to be done

File Systems What if you wanted some information from a file quickly? Could not be done using a traditional file system. Why? Programs specified exact structure of a file. Think of the complexity if information was required from multiples files!

File Systems What if you wanted to change the structure of a file? All the programs that used that file would have to be changed

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

Database Database A Database contains: A structure that contains logically related data in a single repository A Database contains: End user component – data Metadata – data about data

Database Types of Databases Centralized Distributed: Supports one or more users at a time Database is in one physical location Database could be on a pc, a mid-range, or a main-frame Distributed: Data is distributed at several physical locations Database at each physical locations can vary (i.e. one location might have the database on a mid-range, one might have it on a pc)

Database vs. File System

Database Uses Production or Transaction Decision Support Supports day-to-day operations Decision Support Information for tactical or strategic decision making Data Warehouse Historical data

Advantages of Database Processing Ability to get more information from the same amount of data i.e. all customer related data is in one customer place Sharing data Data is available to be use by authorized users Controlling Redundancy Only a single copy of the data exists

Advantages of Database Processing Balancing Databases are structured to benefit all users in the organization, not just a single group Expanding security Access to data can be password protected or can restrict access to data – read only, update

Advantages of Database Processing Increasing Productivity Ability to write ad hoc queries Users don’t have to know exact structure of the data Provides data independence Can change the structure of the data without having to change the programs that access it

Disadvantages of Database Processing Large file size Files now include metadata information Increased complexity Need to take into consideration data design, security, backup and recovery, integrity

Disadvantages of Database Processing Greater impact of failure Data is now shared, if a failure occurs, many users are impacted More difficult recovery If data can be updated by many users at the same time, how can it be recovered to the correct state for all users correctly

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

Database Management System (DBMS) Collection of programs that manages database structure and controls access to the database (and ultimately the data) Manages sharing of data among multiple applications and users Data is more consistent Ability to do ad hoc querying

Database Management System (DBMS)

Importance of a DBMS For Top Management For Middle Management Provides information necessary for strategic decision making and planning Provides access to external and internal data Provides information on company performance and whether the company is achieving their goals (targets) or not For Middle Management Provides information necessary for tactical decision making planning

Importance of a DBMS For Operational Management For Other Users Provides timely information Represents and supports the company operations as closely as possible (operational data) For Other Users Produces results within specified performance levels

Agenda Introduction to the course website Data vs. Information File Systems Database Database Management System Database Design

Database Design Defines the database’s expected use Avoids redundant data (unnecessarily duplicated) Eliminates poorly designed databases Done within a systems development life cycle (SDLC) framework Database Design has it’s own framework, within the SDLC called the Database Life Cycle (DBLC)

Database Design

Database Design Different database design strategies exist: top-down, bottom-up, centralized and decentralized

DBS201: Introduction to Structured Query Language (SQL) Lecture 1

Agenda The basic commands and functions of SQL How to use SQL to query a database to extract useful information (The SELECT statement)

Introduction to SQL SQL: Structured Query Language Designed specifically for communicating with databases SQL functions fit into three broad categories: Data definition language (DDL) Data manipulation language (DML) Transaction Control Language (TCL)

Introduction to SQL (continued) Data definition language SQL includes commands to create Database objects such as tables Commands to define access rights to those database objects Data manipulation language Includes commands to insert, update, delete, and retrieve data within the database tables objects Transaction control language Includes commands to ensure the integrity of the database.

Introduction to SQL (continued) SQL is relatively easy to learn Basic command set has a vocabulary of less than 100 words Sample vocabulary: CREATE COLLECTION CREATE TABLE CREATE VIEW

Introduction to SQL (continued) Sample vocabulary (continued): DROP COLLECTION DROP TABLE DROP VIEW ALTER INSERT SELECT DELETE

Introduction to SQL (continued) American National Standards Institute (ANSI) prescribes a standard SQL Several SQL dialects exist DB2, Oracle, MySQL, Access etc

Data Manipulation Commands SELECT attributes also called fields FROM table(s) WHERE condition(s) ORDER BY attribute(s)

Sample Table: PART 104 HW 3 23.95 20 SG 2 12.95 40 1 29.95 95 24.95 11 PART NUMBER PART DESC ON HAND CLASS WAREHOUSE PRICE AX12 Iron 104 HW 3 23.95 AZ52 Dartboard 20 SG 2 12.95 BA74 Basketball 40 1 29.95 BH22 Cornpopper 95 24.95 BT04 Gas Grill 11 AP 149.99 BZ66 Washer 52 399.99 CA14 Griddle 78 39.99 CB03 Bike 44 299.99 CX11 Blender 112 22.95 CZ81 Treadmill 68 349.99

Listing Table Rows SELECT Syntax Used to list contents of table SELECT Field1, Field 2,… FROM tablename WHERE Condition 1 AND/OR Condition 2 ORDER BY Field1, Field 2,…

Listing Table Rows At a minimum, must specify what you want to select and where you want to select it from SELECT PART_NUMBER FROM PART

Listing Table Rows, specifying a specific field name

Listing All Table Rows Asterisk can be used as wildcard character to list all attributes SELECT * FROM PART

Listing Table Rows with * to represent all field names

Selecting Rows with Comparison Operators Select partial table contents by placing restrictions on rows to be included in output Add conditional restrictions to the SELECT statement, using WHERE clause SELECT * FROM PART WHERE ON_HAND > 30

Listing Table Rows with * to represent all field names

Comparison Operators

Selecting Rows with Comparison Operators Note criteria is in Quotes – PART_NUMBER is a character field SELECT * FROM PART WHERE PART_NUMBER = ‘AX12’

Sorting Output Data is displayed in the order which it was added to the tables initially To change the order the data is displayed in, use the ORDER BY clause in the SELECT statement SELECT * FROM PART ORDER BY ON_HAND

Sorting Output – Single Column SELECT * FROM PART ORDER BY ON_HAND

Sorting Output – Multiple Columns Note how boat name is sorted within owner num SELECT * FROM PART ORDER BY PRICE, PART_NUMBER

Sorting Output Data is displayed in the order which it was added to the tables initially To sort data in descending order, use the DESC keyword after each field specified in the ORDER BY clause that is to be displayed in descending order

In Summary SELECT statement Syntax Used to list contents of table Syntax SELECT Field1, Field 2,… FROM tablename WHERE Condition 1 AND/OR Condition 2 ORDER BY Field1, Field 2,…