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

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 David M. Kroenke’s Chapter Eight: Database Redesign Database Processing:
Fundamentals, Design, and Implementation, 9/e Chapter 8 Database Redesign.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
SQL SQL stands for Structured Query Language SQL allows you to access a database SQL is an ANSI standard computer language SQL can execute queries against.
Structured Query Language SQL: An Introduction. SQL (Pronounced S.Q.L) The standard user and application program interface to a relational database is.
MySql In Action Step by step method to create your own database.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
INTERNET APPLICATION DEVELOPMENT For More visit:
Creating Databases with MySQL Workbench Build the Forums database in Ullman’s Chapter 6.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
CS 174: Web Programming September 23 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
Entity-Relationship (ER) Modelling ER modelling - Identify entities - Identify relationships - Construct ER diagram - Collect attributes for entities &
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Visual Programing SQL Overview Section 1.
1 MySQL and SQL. 2 Topics  Introducing Relational Databases  Terminology  Managing Databases MySQL and SQL.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Fundamental of Database Systems
Databases Stefano Grazioli.
CompSci 280 S Introduction to Software Development
Fundamentals of DBMS Notes-1.
Web Systems & Technologies
Module T03d Software Engineering
Logical DB Design: ER to Relational
Chapter 5 Introduction to SQL.
CS320 Web and Internet Programming SQL and MySQL
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
CS 480: Database Systems Lecture 13 February 13,2013.
Introduction to Structured Query Language(SQL)
BUS 602: Quantitative Methods in Business
Database Keys and Constraints
Payroll Management System
MySQL Joins MySQL joins are used to combine rows from two or more tables. Different SQL JOINs INNER JOIN: Returns all rows when there is at least one match.
CIS 336 str Education for Service-- tutorialrank.com.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Chapter 8 Working with Databases and MySQL
Teaching slides Chapter 8.
PHP and MySQL.
Structured Query Language
CMPT 354: Database System I
CS122 Using Relational Databases and SQL
SQL-1 Week 8-9.
CS3220 Web and Internet Programming SQL and MySQL
CS1222 Using Relational Databases and SQL
A Very Brief Introduction to Relational Databases
Chapter 11 Managing Databases with SQL Server 2000
Web 104: Intro to Apache, MySQL, & PHP
IST 318 Database Administration
SQL Tutorial w3schools.
CS3220 Web and Internet Programming SQL and MySQL
DATABASE Purpose of database
Assignment: SQL #2 Putting Information into a Database
CS122 Using Relational Databases and SQL
SQL AUTO INCREMENT Field
Presentation transcript:

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

Real ER Diagram Here is the ER diagram for a fairly small application known as Drupal.

Assignment 1: OK solution studenttID INT: Primary Key, Not Null, Unsigned, Auto-Increment firstName Varchar(255) lastName middleName streetAddress cityName zipCode INT phoneNumber dateOfBirth DATE ssn facultyID INT: Primary Key, Not Null, Unsigned, Auto-Increment firstName Varchar(255) lastName middleName streetAddress cityName zipCode INT phoneNumber dateOfBirth DATE ssn guardianID Foreign Key studenttID relationship Varchar(255) facultyID Foreign Key specializationID guardianID INT: Primary Key, Not Null, Unsigned, Auto-Increment firstName Varchar(255) lastName middleName streetAddress cityName zipCode INT phoneNumber dateOfBirth DATE ssn specializationID INT: Primary Key, Not Null, Unsigned, Auto-Increment specialization Varchar(255)

Assignment 1: Better Solution roleID INT: Primary Key, Not Null, Unsigned, Auto-Increment roleName Varchar(255) roleDescription cityID INT: Primary Key, Not Null, Unsigned, Auto-Increment cityName Varchar(255) zipCode INT personID INT: Primary Key, Not Null, Unsigned, Auto-Increment firstName Varchar(255) lastName middleName streetAddress cityID Foreign Key phoneNumber INT dateOfBirth DATE ssn INT (unique key) roleID studenttID Foreign Key relationship Varchar(255) personID Foreign Key specializationID specializationID INT: Primary Key, Not Null, Unsigned, Auto-Increment specialization Varchar(255) Description Blob

Review: Setting up your VM Install VirtualBox Create a guest machine Install Debian (we are using version 8) Do not install the user interface options Edit repository list at /etc/apt/sources.list Add the following servers to the list: deb http://httpredir.debian.org/debian jessie main contrib non-free deb-src http://httpredir.debian.org/debian jessie main contrib non-free Comment out the cdrom and the other servers Remember to do an apt-get update and apt-get upgrade Install MySQL apt-get install mysql-server Configure MySQL and users to allow remote access Edit /etc/mysql/my.cnf Change the Bind-Address FROM 127.0.0.1 TO 0.0.0.0

Setting up a remote MySQL user Log into mysql by typing mysql –u username –p Inside of the mysql shell add a new user using the following command: CREATE USER ‘username’@’%’ IDENTIFIED BY ‘password’; GRANT ALL ON *.* TO ‘username’@’%’; Remember to restart the service by typing service mysql restart Install MySQL Workbench on you actual computer and connect to your SQL server. You will need the VM ip address. Your server IP address can be found by typing: ifconfig

Quiz 2 Name three possible table relationships in a database (aka cardinalization types)? In general, what is the difference between Char and Varchar? What is the difference between a Primary Key and a Foreign Key? What is a Master Table and why do we use them? What is a Transition (or Associative) Table and why do we use them?

Quiz 2: #6 What is the result of the following SQL command? (See table below) SELECT CustomerID, CustomerName  FROM Customers  WHERE Country = ‘USA’ OR Country = ‘Sweden’ ; CustomerID CustomerName Address City PostalCode Country 1 Alfreds Futterkiste Obere Str. 57 Berlin 12209 Germany 2 Ana Trujillo Avda. de la Constitución 2222 México D.F. 05021 Mexico 3 Marcus Smith Mataderos 2312 05023 USA 4 Michael Durant 120 Hanover Sq. London WA1 1DP UK 5 Jojo Snabbköp Berguvsvägen 8 Luleå S-958 22 Sweden

Assignment 2: Journeyman Database Update your university database from assignment #1 to include the following new data. For all people, we need to collect information about their gender, date of birth, and disabilities. Change the name of the “specialization” table to “departments” Departments offer courses Each course can be offered more than once per semester A course must have a teacher (faculty) A course may have many students A student can register for many courses At the end of each semester, the teacher must submit a grade for each student.

Intro to SQL Structured Query Language SQL is a scripting language designed specifically for database server. You can type SQL commands inside the MySQL shell or inside the MySQL Workbench query tool. ER diagrams can be translated to SQL commands by exporting them inside MySQL workbench. The 4 most frequently used SQL commands are variations of: Select – used to look up data in the database Insert – inserts new records (or rows) into the database Update – used to change the values inside a record (or row) Delete – removes values from a record (or row) and can be used to completely delete a record

Intro to SQL continued To access data in more than one table, you sometimes need to write more than one SQL command. You can embed one SQL command into another. Some people call statements like this “nested statements” while others call them “subqueries.” For instance, you can retrieve a bunch of user ID’s from one table and use the resultant ID’s to look up specific data for those ID’s in another table. Example: SELECT salary FROM wages WHERE userID = ( SELECT userID FROM employees WHERE status = ‘current‘ )