Advanced Web 2012 Lecture 3 Sean Costain 2012. What is a Database? Sean Costain 2012 A database is a structured way of dealing with structured information.

Slides:



Advertisements
Similar presentations
Database Ed Milne. Theme An introduction to databases Using the Base component of LibreOffice LibreOffice.
Advertisements

VTYS 2012 Mehmet Emin KORKUSUZ Ders  Create  Alter  Drop Data Defination Language.
Database Chapters.
Pertemuan ke 2 Tipe data & ERD Kurniawan Eka Permana.
Day 3 - Basics of MySQL What is MySQL What is MySQL How to make basic tables How to make basic tables Simple MySQL commands. Simple MySQL commands.
Faculty of Sciences and Social Sciences HOPE PHP & MySQL Stewart Blakeway FML 213
SLIDE 1IS 257 – Fall 2010 Physical Database Design and Referential Integrity University of California, Berkeley School of Information IS 257:
Data Modelling. EAR model This modelling language allows a very small vocabulary: Just as English has nouns, verbs, adjectives, pronouns.., EAR models.
Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2010 All Rights Reserved.
ADVM420- Class #4 Web Design with PHP and MySQL Adding and Listing from a MySQL Database.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
SQL Basics+ Brandon Checketts. Why SQL? Structured Query Language Structured Query Language Frees programmers from dealing with specifics of data persistence.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
ASP.NET Programming with C# and SQL Server First Edition
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
CHAPTER 8 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
Designing a Database (Part I) -Identify all fields needed to produce the required information -Group related fields into tables -Determine Each Table’s.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CSC 2720 Building Web Applications Database and SQL.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Information Systems & Databases 2.2) Organisation methods.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
ITGS Databases.
What is a Database?. “A persistent & organised store of data. ” Persistent:  Non-volatile  Using secondary storage Organised:  Data organised into.
DAT602 Database Application Development Lecture 2 Review of Relational Database.
+ Information Systems and Databases 2.2 Organisation.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Data types  CHAR (size): This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters.
Fox MIS Spring 2011 Database Week 6 ERD and SQL Exercise.
Lesson 2: Designing a Database and Creating Tables.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Sql DDL queries CS 260 Database Systems.
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
IMS 4212: Data Modeling—Attributes and Domains 1 Dr. Lawrence West, Management Dept., University of Central Florida Attributes and Domains.
Planning & Creating a Database By Ms. Naira Microsoft Access.
Flat Files Relational Databases
Mr C Johnston ICT Teacher
Introduction to MySQL Lab no. 9 Advance Database Management System.
1 CS 430 Database Theory Winter 2005 Lecture 11: SQL DDL.
Class 3Intro to Databases Class 4 Simple Example of a Database We’re going to build a simple example of a database, which will allow us to register users.
Relational Databases and MySQL. Relational Databases Relational databases model data by storing rows and columns in tables. The power of the relational.
Sample Table Standard Notation Entity name in uppercase
Introduction to MySQL Ullman Chapter 4. Introduction MySQL most popular open-source database application Is commonly used with PHP We will learn basics.
Hoi Le. Why database? Spreadsheet is not good to: Store very large information Efficiently update data Use in multi-user mode Hoi Le2.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Lecture 1.21 SQL Introduction Steven Jones, Genome Sciences Centre.
Creating a database table
Databases Chapter 9 Asfia Rahman.
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Data Definition and Data Types
Lecture 6 Data Model Design (continued)
Unit 16 – Database Systems
Lesson 7 Managing Data Creating a database with Web Matrix.
Database systems Lecture 2 – Data Types
Computer Science Projects Database Theory / Prototypes
Attributes and Domains
Chapter 4 Introduction to MySQL.
MySQL Database System Installation Overview SQL summary
ICT Database Lesson 2 Designing a Database.
Kirkwood Center for Continuing Education
Database Instructor: Bei Kang.
Presentation transcript:

Advanced Web 2012 Lecture 3 Sean Costain 2012

What is a Database? Sean Costain 2012 A database is a structured way of dealing with structured information. An organized mechanism for storing, managing and retrieving information. Information is stored in tables Think of a table as a single spreadsheet, a database consists of multiple spreadsheets that can be linked together using a key.

Types of Data - Numeric Sean Costain 2012 Tinyint – Use as a boolean Int – Use for uid/id number

Types of Data – Numeric cont. Sean Costain 2012 Fixed Point – Decimal, Numeric -Use decimal as numeric defaults to decimal -eg: salary DECIMAL (5,2) Allows for the range to Floating Point – float, double -Use float - eg: salary FLOAT (7,4) Allows for the range to Floating point rounds numbers, so not exact for storage, stick to using decimal.

Types of Data – Date and Time Sean Costain 2012 DATETIME has a supported range is ' :00:00' to' :59:59'. TIMESTAMP has a range of' :00:01' UTC to ' :14:07' UTC. The DATETIME and TIMESTAMP type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME & TIMESTAMP values in 'YYYY-MM-DD HH:MM:SS' format.

Types of Data – Strings Sean Costain 2012 String Types -Char -VarChar -Binary -Varbinary -Blob -Text -Enum -Set The useful String types -Varchar -Blob -Text A varchar can have a set length, eg: varchar(4) means that the field being entered can contain exactly 4 characters. Useful for storing simple data like, M/F, names varchar (60)….

Types of Data – Strings Sean Costain 2012 Blobs -Tinyblob -Blob -Mediumblob -Longblob BLOB values are treated as binary strings (byte strings). They have no character set, and sorting and comparison are based on the numeric values of the bytes in column values. Blobs can store images

Types of Data – Strings Sean Costain 2012 Text -Tinytext -Text -Mediumtext -Longtext TEXT values are treated as nonbinary strings (character strings). They have a character set, and values are sorted and compared based on the collation of the character set. Text stores … text! (strings)

Types of Data – Size Sean Costain 2012

Normalisation Sean Costain 2012 Normalisation Rules 1 st Normal Form Eliminate repeating groups Create a table for related data Identify each table with a primary key 2 nd Normal Form Create tables for sets of values that apply to multiple records Relate these tables with a foreign key 3 rd Normal Form Eliminate fields that do not depend on the key Normalization is the process of organizing data in a database. This includes creating tables and establishing relationships between those tables according to rules designed both to protect the data and to make the database more flexible by eliminating redundancy and inconsistent dependency.

Normalisation Example Sean Costain 2012 Simple spreadsheet that contains student detail. It works, but sorting by student name or subject would be pretty insane, so we need to normalise the information for storing into a database.

Normalisation Example Cont. Sean Costain 2012 Normalisation on data, break it down and add unique identifiers (uid or id) So this is the first breakdown of the data, but it’s not broken down enough yet

Normalisation Example Cont. Sean Costain 2012 The address can be broken down further There has to be links to keep the data consistent

Normalisation Example Cont. Sean Costain 2012 Table linking – Student to address

Normalisation Example Cont. Sean Costain 2012 Table linking – Subject to Date Though a good break down, reality doesn’t always fall into 3 rd Normal form, so you can break the rules.

Normalisation Example Cont. Sean Costain 2012 Table linking – Add Student to Subject and Date

ERD – Entity Relationship Diagram Sean Costain 2012 Links the tables by Headers

ERD – Entity Relationship Diagram Sean Costain 2012 All of the tables shown with linking

phpmyAdmin Sean Costain 2012 Creating a Database -Make a user with the correct privileges -Create a database -Add tables to database -Insert data to tables Start by having the web server running, get to the web control via - localhost/phpmyadmin

Creating a user Sean Costain 2012 Privileges - Add User

Fill in the Blanks Sean Costain 2012 Webservers recognise themselves as localhost

Create Database Sean Costain 2012 Start Adding tables

Database Fields Sean Costain 2012 Fill in the blanks, such as name, type if it’s auto incrementing and a primary key

Database Sean Costain 2012 You should end up with multiple tables for your database