Instructor Information: Mark Jamil

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
Advertisements

What is a Database By: Cristian Dubon.
Course Goals Introduce Terms Skills –Modern DBMS (SQL Server 2008) –SQL querying and data access –Stored procedures including parameters –Brief introduction.
Database Management An Introduction.
Using Relational Databases and SQL Steven Emory Department of Computer Science California State University, Los Angeles Lecture 1: Introduction to Relational.
3-1 Chapter 3 Data and Knowledge Management
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
CS 474 Database Design and Application Terminology Jan 11, 2000.
PHP meets MySQL.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
1 Working with MS SQL Server Textbook Chapter 14.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Bits & Bytes Created by Chris McAbee For AAMU AGB199 Extra Credit Created from information copied and pasted from
More Binary How does a computer represent everything using just zeros and ones?
Class Introduction IST 210: Organization of Data IST2101.
How does a computer works Hyoungshick Kim Department of Computer Science and Engineering College of Information and Communication Engineering Sungkyunkwan.
N5 Databases Notes Information Systems Design & Development: Structures and links.
Introduction to CSCI 1311 Dr. Mark C. Lewis
Creating Databases for Web applications
Introduction to Computers
The Study of Computer Science Chapter 0
Week 2 - Wednesday CS 121.
Understanding Data Storage
Fundamentals of Database
Activity 1 6 minutes Research Activity: What is RAM? What is ROM?
Databases Chapter 9 Asfia Rahman.
Module 11: File Structure
Memory COMPUTER ARCHITECTURE
INFS 211: Introduction to Information Technology
INLS 623– Database Systems II– File Structures, Indexing, and Hashing
Introduction To Database IT-402
GO! with Microsoft Office 2016
CHP - 9 File Structures.
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Databases Chapter 16.
BUS 602: Quantitative Methods in Business
GC101 Introduction to computers and programs
Database Normalization
Introduction to Web programming
Information Support and Services
The Study of Computer Science Chapter 0
GO! with Microsoft Access 2016
Introduction to Database Systems
CIS 336 strCompetitive Success/tutorialrank.com
CIS 336 str Education for Service-- tutorialrank.com.
CS 174: Server-Side Web Programming February 12 Class Meeting
“Introduction To Database and SQL”
System And Application Software
Teaching slides Chapter 8.
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Chapter 3 Hardware and software 1.
Data Types & File Size Calculations
What Are They? Who Needs ‘em? An Example: Scoring in Tennis
Presenting information as bit patterns
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
Chapter 3 Hardware and software 1.
The Study of Computer Science
Tonga Institute of Higher Education IT 141: Information Systems
Spreadsheets, Modelling & Databases
Homework Reading Programming Assignments Finish K&R Chapter 1
The ultimate in data organization
Web 104: Intro to Apache, MySQL, & PHP
Tonga Institute of Higher Education IT 141: Information Systems
The Study of Computer Science Chapter 0
ITS 200: Computer System Security
Information system analysis and design
Presentation transcript:

Instructor Information: Mark Jamil questions@markjamil.com ITS 180: Database Design Instructor Information: Mark Jamil questions@markjamil.com

Who am I? Long time San Diegan I Love Science and Technology Built my 1st PC from thrown away parts during high school. 33Mhz CPU, 4x 64k RAM, 64k cache, 40MB Disk Drive, DOS 4.0 1st post-college job: Human genome project Mathematical modeling of proteins 1st well paying job: Systems Administrator Media production operations (news) Later started my own business: Media & Software Production Studio Work was bought by Disney and Art Institute of LA

About this course This is not a pure programming course… per se. You will not be graded on your knowledge of programming but rather on your ability to logically design and use databases. Functional code is important to help facilitate your learning however in most cases I will accept pseudo-code and non-working code as long as you demonstrate that you understood the concept. This is not a writing class. You will not be graded on spelling, punctuation, or grammar but you will be graded on the content of your answers. I prefer teaching database design as a practical lab course. Rather than lecture, most of the course time will be spent solving practical problems in a lab style environment. During lab you will be able to ask questions, work together to solve problems, and learn at your own pace.

Goals The goals of this course include: Understanding hardware requirements for creating database driven applications Learn how to set up a database server Learn how to use support software (mysql workbench) Learn how to use SQL Learn how to design an efficient database application

Grading Information POSSIBLE EXTRA CREDIT Attendance (10 points possible) Class participation (10 points possible) Quizzes (20 points possible) Assignments (40 points possible) Final Project (20 points possible) ----------------------------------------------------------- 100 Points Possible Points Grade | Points Grade -------------------------------------------------------------------------------------------------------------------------- 98-100 A+ | 70-79 C 93-97 A | 60-69 D 90-92 A- | 59 or less F 88-89 B+ | 80-87 B | 80-82 B- | POSSIBLE EXTRA CREDIT 5 Extra Credit Points - Perfect Attendance 10 Extra Credit Points - Optional Programming Project

EXTRA CREDIT Perfect Attendance (5 Points Extra Credit) Must be present at all class meetings Cannot be more than 15 minutes late to class Extra Credit Programming Project (10 Points Extra Credit) Create an end user GUI for the database driven application based on the database we are working on in class. You may use any programming language to create the GUI. It can be web driven or standalone. You may use any of the following for development: PHP: Netbeans (free) or PHPStorm (commercial) C#: Visual Studio Express (free) or MonoDevelop (free) C++: Visual Studio Express (free) or Qt (free) Python: PyDev Eclipse (free) or PyCharm (commercial)

Hints for Getting an “A” Attendance is important Points just for being in class! (10 points) Course is structured around discussions (10 points) Quiz questions are taken directly from discussion (20 points) Perfect Attendance Bonus (5 points) 45 points can easily be earned by simply attending class! Most assignment can be completed in class (40 points)

Assessment Questionnaire (aka Quiz 1) Do you have any experience with database development? What software have you used? Do you have any programming experience? If so, what languages and IDE’s are you familiar with? What does the following SQL command do? SELECT CustomerID, phone1  FROM Customers  WHERE CustomerName <> 'Jessica Simpson'  SELECT a.CustomerID, a.CustomerName, a.phone1  FROM Customers AS a INNER JOIN Customers AS b  ON a.City = b.City  WHERE b.CustomerName='Jessica Simpson'  AND a.CustomerName<>'Jessica Simpson‘ SELECT SUM (Sales) FROM StoreInformation WHERE StoreName IN (SELECT StoreName FROM Geography WHERE RegionName = 'West');

In the Beginning… Data was written into stone tablets. Then we had paper. Then we had a lot of paper bound together into books. Then we started organizing books: Page numbering. We separated books into chapters. Chapters were listed in an index. Books were taking up too much space so we started looking for ways to shrink them… anyone remember the microfiche? Then we created integrated circuits allowing us to store a lot of data on electronic parts. Time for a game…

Early Electronic Data Storage This is how data was stored initially. This is inefficient because every time we wanted to search for a piece of data, we had to transverse all the data until we found what we are looking for. For example, how many sentences are in this paragraph? You would need to read the entire paragraph and search for end of sentence punctuations to figure out that there are four sentences. Or are there only three? Maybe there are five but the point is that this is very time consuming and even a computer can be brought to its knees if there is a very large set of data to transverse. Okay lets call it seven sentences. Really I am not kidding this time…

Enter Big Data Initially, electronics were so fast at storing and looking up data, people did not worry about performance issues. Once the amount of data grew, it became obvious that we needed to find a better way to organize the data. Enter IBM. To meet the need for big data companies started creating commercial database systems. The 1st IBM database was called IMS and was sold to the government for the Apollo space program in the 1960’s. The 1st commercially success database was Saber, and was purchased by American Airlines, also in the 1960’s. IMS and Saber were hierarchical databases. IBM researcher (Ed Cobb) theorizes the relational database. IBM switched all their data products to the relational model in the 70s (System R) and continued their virtual monopoly on business computing well into the 80s. System R was the 1st database to use a query language called “Sequel.” “Sequel” was later changed to “SQL” due to copyright issues with the name “Sequel.”

What happened next? Due to the high cost of IBM hardware/software, students at UC Berkeley made their own relational database for educational use in the early 70s. It was called Ingres. Ingress was the 1st open source relational database. It used a scripting language called QUEL . Database systems that used Ingress source code include: MS SQL, Sybase, & Posgres. Knowing IBM was costly and that UC Berkeley did not have money to market their database; Larry Ellison decided to make his own relational database backed by investors. It was called Oracle. Oracle took market share from Ingress mostly due to huge marketing campaigns. Oracle used SQL. Lets play another game…

Better Data Storage This is inefficient because every time we wanted to search for a piece of data, we had to transverse all the data until we found what we are looking for. For example, how many sentences are in this paragraph? You would need to read the entire paragraph and search for end of sentence punctuations to figure out that there are four sentences. Or are there only three? Maybe there are five but the point is that this is very time consuming and even a computer can be brought to its knees if there is a very large set of data to transverse. Okay lets call it seven sentences. Really I am not kidding this time.

Definitions SQL (pronounced S-Q-L or sequel) Database Table Record Structured Query Language. Is a computer language used to communicate with most modern database systems. Database Is an organized collection of data used to provide information. Table A data storage method using rows and columns. In computer science, rows are also referred to as “Records” and columns are referred to as “Fields.” Record Is a row in the database. Field Is a column in the database.

Definitions Primary Key Foreign Key Index Is a field (or column) that contains unique data within a table. Because the data is the column is unique, every row (or record) becomes unique. A table may have multiple keys or no keys at all. If you have more than one key in a table, it is called a composite key. For our purposes, keys are required to form relations. Foreign Key Is a relation formed between two tables where one table utilizes a primary key from the other related table, as part of its data. Foreign Keys are NOT necessarily unique. Foreign Keys provide integrity because they MUST match a Primary Key in the related table. Index Can be applied to columns or rows. Indices are NOT Keys!!!! They create a pointer to a record or field for faster database lookup. Typically copy data thus requiring extra memory.

Relationships (aka Cardinality) One-to-One Each row in one table, corresponds to exactly one row in another table. One-to-Many Each row on one table can correspond to many rows in another table. Many-to-Many Every row may have one or more associated rows in another related table.

Entity Relation (ER) Diagram

Computer Memory Current computers store memory in units called bits. Bits are represented by 0 and 1 What does 32 bit mean? A computer that has a 32 bit CPU can process 32 bits (32 zero’s or one’s) in a single cycle (measured in hertz or 1/s). What is a byte? A byte is 8 bits such as 0000 0000 or 1010 0101

Beware of the difference in Bit and Byte Historically computer memory is labeled in bytes. 512 kiloBYTEs Cache 128 megaBYTEs of RAM 4 teraBYTE Hard Drive 1 petaBYTE = 1000 teraBYTEs 1 exaBYTE = 1000 petaBYTEs Internet Service Providers use bits instead of bytes. 2 MB service means 2 megaBITs not bytes!! 2 Mbits service means 250 Kbytes per second. Question: How long would it take to fill a 10 Mbyte hard drive with data streaming from a 10 Mbit internet connection?

How do we store data in bits? How do I store the number 5 in Binary? You need 3 bits of storage 0 0 0 = 0 0 0 1 = 1 0 1 0 = 2 0 1 1 = 3 1 0 0 = 4 1 0 1 = 5 1 1 0 = 6 1 1 1 = 7 What happens if someone wants to store larger numbers? Or even words? The relationship between bits and how many permutations it can have is 2n. Thus if you want to store the number 128, you need at least 7 bits of storage space (27 = 128) How are letters stored? Letters are encoded. There are many different encoding systems such as ASCII or UTF-8 ASCII stores everything in 8 bits of data (aka hex) “A” is equivalent to “65” or 0100 0001 “a” is equivalent to “97” or 0110 0001 “1” is equivalent to “1” or 0000 0001 Null is equivalent to “0” or 0000 0000

Data Types Databases generally store human readable data be it a number or some text Common data types (sizes are not always the same!) Data Type Size Limit How it is stored ------------------------------------------------------------------------ INT 4 bytes Fixed Can store value of + or - 2 billion. Or unsigned up to 4 billion DATETIME 8 bytes Fixed BOOLEAN 1 byte Fixed CHAR 0-255 bytes Fixed VARCHAR 0-255 bytes Variable Always adds 1 extra byte for storing its own length BLOB 0-65k bytes Variable Since it stores twice as much as Varchar, it needs 2 bytes of storage for length

Table Example MovieName MovieGenre MovieYear Star Wars Drama, Action, Science Fiction 1977 Gladiator Drama 1992 Ju-On Horror 2001 Action 1955 The Matrix Action, Sience Fiction 2003 2000 Hercules 2013

Unique Records (Unique Keys) MovieID MovieName MovieGenre MovieYear 1 Star Wars Action, Drama, Science Fiction 1977 2 Gladiator Drama 1992 3 Ju-On Horror 2001 4 Action 1955 5 The Matrix Action, Sience Fiction 2003 6 2000 7 Hercules 2013 8

Data Integrity (Incorrect Data Entry) MovieID MovieName MovieGenre MovieYear 1 Star Wars Action, Drama, Science Fiction 1977 2 Gladiator Drama 1992 3 Ju-On Horror 2001 4 Action 1955 5 The Matrix Action, Sience Fiction 2003 6 2000 7 Hercules 2013 8

Better Integrity 1977 1992 2001 Transition Table 1955 2003 2000 2013 MovieID GenreID 1 2 5 3 4 6 7 8 Transition Table MovieID MovieName MovieYear 1 Star Wars 1977 2 Gladiator 1992 3 Ju-On 2001 4 1955 5 The Matrix 2003 6 2000 7 Hercules 2013 8 GenreID Genre 1 Action 2 Drama 3 Comedy 4 Horror 5 Science Fiction Master Table