! Quick review of ! normalization! referential integrity ! Basic MySQL ! Other types of DBs

Size: px
Start display at page:

Download "! Quick review of ! normalization! referential integrity ! Basic MySQL ! Other types of DBs"

Transcription

1 CS 418/518 Web Programming Spring 2014 MySQL Dr. Michele Weigle Outline! Assigned Reading! Chapter 3 "Using PHP5 with MySQL"! Chapter 10 "Building Databases"! Resource: dev.mysql.com/doc/! Quick review of relational databases! normalization! referential integrity! Basic MySQL commands! Other types of DBs! Ch 3 Code Example Demo/Walkthrough 2

2 Relational Database! Collection of data organized in tables that can be used to create, retrieve, delete, and update that data in many ways 3 Database Keys! Column where each item of data appears only once in that column! Uniquely identifies the row! Primary key unique identifier for the table! Foreign key matches the primary key of another table 4

3 Super Hero Example name Clean Freak Soap Stud The Dustmite real name John Smith Efram Jones Dustin Huff power 1 power 2 power 3 lair address Strength X-ray flight 123 vision Poplar Speed 123 Poplar Strength Dirtiness Laser Vision 452 Elm St. #3D city state zip Townsburg OH Townsburg OH Burgtown OH What if we need to add a super hero with more than 3 powers?! 5 1st Normal Form name Clean Freak Soap Stud The Dustmite real name John Smith Efram Jones Dustin Huff power 1 power 2 power 3 lair address Strength X-ray flight 123 vision Poplar Speed 123 Poplar Strength Dirtiness Laser Vision 452 Elm St. #3D city state zip Townsburg OH Townsburg OH Burgtown OH 45201! Eliminate repeating columns! Add primary key to table! Unique! Must not change! Maintain "atomicity"! Each cell is atomic, has only one item of data 6

4 1NF Result! Eliminate repeating columns! Add primary key to tables! Each attribute is atomic id name real name 1 Clean John Freak Smith 1 Clean Freak 1 Clean Freak 2 Soap Stud 3 The Dustmite 3 The Dustmite 3 The Dustmite John Smith John Smith Efram Jones Dustin Huff Dustin Huff Dustin Huff power lair address Strength 123 Poplar X-ray 123 vision Poplar flight 123 Poplar Speed 123 Poplar Strength 452 Elm St. #3D Dirtiness 452 Elm St. #3D Laser Vision 452 Elm St. #3D city state zip Townsburg OH Townsburg OH Townsburg OH Townsburg OH Burgtown OH Burgtown OH Burgtown OH What if John Smith changes his name? 7 2nd Normal Form! Honor 1st Normal Form! Create separate tables for data duplicated across rows! Be aware of relationships!! 1:1! 1:m! m:n id name real name 1 Clean John Freak Smith 1 Clean Freak 1 Clean Freak 2 Soap Stud 3 The Dustmite 3 The Dustmite 3 The Dustmite John Smith John Smith Efram Jones Dustin Huff Dustin Huff Dustin Huff power lair address city state zip Strength 123 Townsburg OH Poplar X-ray 123 Townsburg OH vision Poplar flight 123 Townsburg OH Poplar Speed 123 Townsburg OH Poplar Strength 452 Burgtown OH Elm St. #3D Dirtiness 452 Burgtown OH Elm St. #3D Laser 452 Burgtown OH Vision Elm St. #3D 8

5 2NF Result id lair_id name real name 1 1 Clean John Freak Smith 2 1 Soap Efram Stud Jones 3 2 The Dustin Dustmite Huff id lair address Poplar Elm St. #3D align good good evil city state zip Townsburg OH Burgtown OH 45201! Satisfy 1NF! Create separate tables for data duplicated across rows id power 1 Strength 2 X-Ray vision 3 Flight 4 Speed 5 Dirtiness 6 Laser Vision 9 char_id power_id Are "city" and "state" directly related to the lairs? 3rd Normal Form! Honor 1st and 2nd Normal Form! Create separate tables for any transitive or partial dependencies id lair address Poplar Elm St. #3D city state zip Townsburg OH Burgtown OH

6 3NF Result id lair_id name real name 1 1 Clean John Freak Smith 2 1 Soap Efram Stud Jones 3 2 The Dustin Dustmite Huff id zip_id lair address Poplar Elm St. #3D id power 1 Strength 2 X-Ray vision 3 Flight 4 Speed 5 Dirtiness 6 Laser Vision align good good evil id city state Townsburg OH Burgtown OH char_id power_id ! Satisfy 2NF! Create separate tables for any transitive or partial dependencies see note on p. 283 on why good/evil is not in a separate table 11 That's About as Far As We'll Go! Other normal forms are possible (BCNF, 4NF, 5NF)! take a database class if you're interested! Referential integrity! loss of integrity - a foreign key ("link") into another table is no longer valid! "404 Errors" are bad in databases and should not happen! how bad is a function of the data itself 12

7 Outline! Quick review of relational databases! normalization! referential integrity! Basic MySQL commands! Other types of DBs! Ch 3 Code Example Demo/Walkthrough 13 Standardization! Table names! descriptive describe their main function and the application they belong to! relatively short! lowercase! Column names! lowercase! short! separate words by '_'! Primary keys! single primary keys always called 'id'! Foreign keys! end with 'id'! start with table descriptor 14

8 MySQL Hierarchy - For CS 418/518 server = weiglevm.cs.odu.edu database=mweigle movie_main movie_people char_main char_power movie_type char_lair database=student1 database=student2 We're sharing a single server, so each student has a single database (same as your username). Table names should start with the project or application name. 15 phpmyadmin! Access your MySQL databases through a GUI! Change your password! Create, edit, delete tables! Run (and test) queries! View and print table structure 16

9 Command Line MySQL - weiglevm! /usr/bin/mysql -p! -p: will prompt for passwd 17 Manipulating Tables and Databases! CREATE - create new databases, tables! ALTER - modify existing tables! DELETE - erase data from tables! DESCRIBE - show structure of tables! INSERT INTO tablename VALUES - put data in table! UPDATE - modify data in tables! DROP - destroys table or database (values + structure) more: 18

10 Native MySQL Data Types! Unlike Perl, PHP and other civilized languages, MySQL is big into data types:! pgs in Ch 3! many examples in Chs 3, SQL Query Form SELECT [fieldnames]!!from [tablenames]!!where [criteria]!!order BY [fieldname to sort on] [DESC]!!LIMIT [offset, maxrows]! more: look at chapters 3 and 10 for code examples 20

11 SELECT Examples products productid productcode name quantity price PEN Pen Red PEN Pen Blue PEN Pen Black PEC Pencil 2B PEC Pencil 2H mysql> SELECT name, price FROM products; name price Pen Red 1.23 Pen Blue 1.25 Pen Black 1.25 Pencil 2B 0.48 Pencil 2H SELECT Examples products productid productcode name quantity price PEN Pen Red PEN Pen Blue PEN Pen Black PEC Pencil 2B PEC Pencil 2H mysql> SELECT name, price FROM products WHERE price < 1.0; name price Pencil 2B 0.48 Pencil 2H

12 SELECT Examples products productid productcode name quantity price PEN Pen Red PEN Pen Blue PEN Pen Black PEC Pencil 2B PEC Pencil 2H mysql> SELECT name, price FROM products WHERE productcode = 'PEN'; name price Pen Red 1.23 Pen Blue 1.25 Pen Black SQL Joins! Pull in data from two different tables id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja 24

13 INNER JOIN! The set of records that match in both tables! aka Intersection SELECT * FROM TableA INNER JOIN TableB ON TableA.name = TableB.name id name id name Pirate 2 Pirate 3 Ninja 4 Ninja id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja 25 FULL OUTER JOIN! Produce set of all records in both tables! aka Union SELECT * FROM TableA FULL OUTER JOIN TableB ON TableA.name = TableB.name id name id name Pirate 2 Pirate 2 Monkey null null 3 Ninja 4 Ninja 4 Spaghetti null null null null 1 Rutabaga null null 3 Darth Vader id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja 26

14 LEFT OUTER JOIN id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja! For each item in Table A, find some data in Table B SELECT * FROM TableA LEFT OUTER JOIN TableB ON TableA.name = TableB.name id name id name Pirate 2 Pirate 2 Monkey null null 3 Ninja 4 Ninja 4 Spaghetti null null 27 LEFT OUTER JOIN id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja! Now, let's exclude items that also appear in Table B SELECT * FROM TableA LEFT OUTER JOIN TableB ON TableA.name = TableB.name WHERE TableB.id IS null id name id name Monkey null null 4 Spaghetti null null 28

15 FULL OUTER JOIN id name id name Pirate 1 Rutabaga 2 Monkey 2 Pirate 3 Ninja 3 Darth Vader 4 Spaghetti 4 Ninja! Find all unique items (those that only are present in one of the two tables, not both) SELECT * FROM TableA FULL OUTER JOIN TableB ON TableA.name = TableB.name WHERE TableA.id IS null OR TableB.id IS null id name id name Monkey null null 4 Spaghetti null null null null 1 Rutabaga null null 3 Darth Vader 29 PHP and MySQL! Connect to the MySQL server! $mysqli = new mysqli ("hostname", "user", "pass", "db")! Send MySQL command/query to server! $results = $mysqli->query("query") To run a php script from command line: % php myscript.php!! Shows error message generated by the MySQL server! $mysqli->error! Release results array! $results->free()! Note: result object is only created for SELECT, SHOW, DESCRIBE or EXPLAIN queries, so for CREATE, INSERT, UPDATE there is nothing to "free".! Close connection! $mysqli->close(); 30 Note: The syntax in the textbook is deprecated

16 Fetching Results! General Note! If two or more columns of the result have the same field (column) names, the last column will take precedence and overwrite the earlier data! Can use alias in SELECT statement (AS keyword)! Can use numeric array index! $results->fetch_array()! stores data in both the numeric indices of the result array AND in associative indices using the field (column) name as the key 31 fetch_array $query="select * ". "FROM lab1_store "; $results = $mysqli->query($query) or die ($mysqli->error. LINE ); lab1_store id name qty price 1 apple pear banana lemon orange $row = $results->fetch_array(); print_r($row); Array( [0] => 1 [id] => 1 [1] => apple [name] => apple [2] => 10 [qty] => 10 ) 32

17 fetch_assoc $query="select * ". "FROM lab1_store "; $results = $mysqli->query($query) or die ($mysqli->error. LINE ); lab1_store id name qty price 1 apple pear banana lemon orange $row = $results->fetch_assoc(); // Following line produces the same results // $row = $results->fetch_array(mysqli_assoc); print_r($row); Array( [id] => 1 [name] => apple [qty] => 10 [price] => 1) 33 fetch_row $query="select * ". "FROM lab1_store "; $results = $mysqli->query($query) or die ($mysqli->error. LINE ); lab1_store id name qty price 1 apple pear banana lemon orange $row = $results->fetch_row(); // Following line produces the same results // $row = $results->fetch_array(mysqli_num); print_r($row); Array( [0] => 1 [1] => apple [2] => 10 [3] => 1) 34

18 PHP and MySQL config.php <?php define ('SQL_HOST', 'localhost'); define ('SQL_USER', 'username'); define ('SQL_PASS', 'passwd'); define ('SQL_DB', 'username');?>! This way you don't have to include your plaintext username and password in your source files: require ('config.php'); $mysqli = new mysqli (SQL_HOST, SQL_USER, SQL_PASS, SQL_DB) Put config.php in ~/cs418_html/ 35 Outline! Quick review of relational databases! normalization! referential integrity! Basic MySQL commands! Other types of DBs! Ch 3 Code Example Demo/Walkthrough 36

19 NoSQL! Database that doesn't use tabular relations! i.e., it's not a relational database! Why?! simplicity of design! horizontal scaling! finer control over availability! often designed for simple retrieve and append operations! don't need to define schemas in advance - more agile development! Examples! Column: HBase, Accumulo! Document: MarkLogic, MongoDB, Couchbase! Key-value : Dynamo, Riak, Redis, Cache, Project Voldemort! Graph: Neo4J, Allegro, Virtuoso 37 NoSQL Database Types! Document databases! pair each key with a complex data structure known as a document! documents can contain many different key-value pairs, or key-array pairs, or even nested documents.! Graph stores! used to store information about networks, such as social connections! Key-value stores! simplest NoSQL databases! every item in the database is stored as an attribute name (or "key"), together with its value.! Wide-column stores! optimized for queries over large datasets, and store columns of data together, instead of rows. 38

20 MongoDB MongoDB 40

21 Outline! Quick review of relational databases! normalization! referential integrity! Basic MySQL commands! Other types of DBs Reminder: Groups due Jan 23 Next Time: MySQL Lab Next Week: Tables, Forms Assigned Reading: Chs 4, 5! Ch 3 Code Example Demo/Walkthrough 41 Demo/Walkthrough Time! Examples from Chapter 3 Creating a Database! Querying the Database! PHP and Arrays of Data! Multiple Tables 42

22 Movie Tables 43 Movie Data movie_main movie_people movie_type 44

Building Databases. In this chapter, we are going to cover the basics of creating your own database. Topics we discuss include:

Building Databases. In this chapter, we are going to cover the basics of creating your own database. Topics we discuss include: 14 557440 Ch09.qxd 2/6/04 9:17 AM Page 237 9 Building Databases In previous chapters, you created a very nice movie review Web site, but now the hand-holding is over, my friend. It s time for us to push

More information

Querying Data with Transact SQL

Querying Data with Transact SQL Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including

More information

CGS 3066: Spring 2017 SQL Reference

CGS 3066: Spring 2017 SQL Reference CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students

More information

Introduction to Big Data. NoSQL Databases. Instituto Politécnico de Tomar. Ricardo Campos

Introduction to Big Data. NoSQL Databases. Instituto Politécnico de Tomar. Ricardo Campos Instituto Politécnico de Tomar Introduction to Big Data NoSQL Databases Ricardo Campos Mestrado EI-IC Análise e Processamento de Grandes Volumes de Dados Tomar, Portugal, 2016 Part of the slides used in

More information

MySQL: Access Via PHP

MySQL: Access Via PHP MySQL: Access Via PHP CISC 282 November 15, 2017 phpmyadmin: Login http://cisc282.caslab. queensu.ca/phpmyadmin/ Use your NetID and CISC 282 password to log in 2 phpmyadmin: Select DB Clicking on this

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Course 20761A: Querying Data with Transact-SQL Page 1 of 5 Querying Data with Transact-SQL Course 20761A: 2 days; Instructor-Led Introduction The main purpose of this 2 day instructor led course is to

More information

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS Questions & Answers- DBMS https://career.guru99.com/top-50-database-interview-questions/ 1) Define Database. A prearranged collection of figures known as data is called database. 2) What is DBMS? Database

More information

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist. CIT 736: Internet and Web Development Technologies Lecture 10 Dr. Lupiana, DM FCIM, Institute of Finance Management Semester 1, 2016 Agenda: phpmyadmin MySQLi phpmyadmin Before you can put your data into

More information

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population In this lab, your objective is to learn the basics of creating and managing a DB system. One way to interact with the DBMS (MySQL)

More information

Querying Data with Transact SQL Microsoft Official Curriculum (MOC 20761)

Querying Data with Transact SQL Microsoft Official Curriculum (MOC 20761) Querying Data with Transact SQL Microsoft Official Curriculum (MOC 20761) Course Length: 3 days Course Delivery: Traditional Classroom Online Live MOC on Demand Course Overview The main purpose of this

More information

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3 1 Chapter 3 Introduction to relational databases and MySQL Slide 2 Objectives Applied 1. Use phpmyadmin to review the data and structure of the tables in a database, to import and run SQL scripts that

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

Distributed Non-Relational Databases. Pelle Jakovits

Distributed Non-Relational Databases. Pelle Jakovits Distributed Non-Relational Databases Pelle Jakovits Tartu, 7 December 2018 Outline Relational model NoSQL Movement Non-relational data models Key-value Document-oriented Column family Graph Non-relational

More information

MTA Database Administrator Fundamentals Course

MTA Database Administrator Fundamentals Course MTA Database Administrator Fundamentals Course Session 1 Section A: Database Tables Tables Representing Data with Tables SQL Server Management Studio Section B: Database Relationships Flat File Databases

More information

20461: Querying Microsoft SQL Server 2014 Databases

20461: Querying Microsoft SQL Server 2014 Databases Course Outline 20461: Querying Microsoft SQL Server 2014 Databases Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions,

More information

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: 20762C Developing SQL 2016 Databases Module 1: An Introduction to Database Development Introduction to the

More information

Introduction to relational databases and MySQL

Introduction to relational databases and MySQL Chapter 3 Introduction to relational databases and MySQL A products table Columns 2017, Mike Murach & Associates, Inc. C3, Slide 1 2017, Mike Murach & Associates, Inc. C3, Slide 4 Objectives Applied 1.

More information

Chapter 3B Objectives. Relational Set Operators. Relational Set Operators. Relational Algebra Operations

Chapter 3B Objectives. Relational Set Operators. Relational Set Operators. Relational Algebra Operations Chapter 3B Objectives Relational Set Operators Learn About relational database operators SELECT & DIFFERENCE PROJECT & JOIN UNION PRODUCT INTERSECT DIVIDE The Database Meta Objects the data dictionary

More information

T-SQL Training: T-SQL for SQL Server for Developers

T-SQL Training: T-SQL for SQL Server for Developers Duration: 3 days T-SQL Training Overview T-SQL for SQL Server for Developers training teaches developers all the Transact-SQL skills they need to develop queries and views, and manipulate data in a SQL

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Querying Microsoft SQL Server 20461D; 5 days, Instructor-led Course Description This 5-day instructor led course provides students with the technical skills required to write basic Transact SQL queries

More information

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 MODULE 1: INTRODUCTION TO MICROSOFT SQL SERVER 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions,

More information

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel 1 In this chapter, you will learn: The basic commands

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Querying Data with Transact-SQL Course: 20761 Course Details Audience(s): IT Professional(s) Technology: Microsoft SQL Server 2016 Duration: 24 HRs. ABOUT THIS COURSE This course is designed to introduce

More information

Sql Server Syllabus. Overview

Sql Server Syllabus. Overview Sql Server Syllabus Overview This SQL Server training teaches developers all the Transact-SQL skills they need to create database objects like Tables, Views, Stored procedures & Functions and triggers

More information

Unit Assessment Guide

Unit Assessment Guide Unit Assessment Guide Unit Details Unit code Unit name Unit purpose/application ICTWEB425 Apply structured query language to extract and manipulate data This unit describes the skills and knowledge required

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL ORACLE UNIVERSITY CONTACT US: 00 9714 390 9000 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database

More information

SQL - Subqueries and. Schema. Chapter 3.4 V4.0. Napier University

SQL - Subqueries and. Schema. Chapter 3.4 V4.0. Napier University SQL - Subqueries and Chapter 3.4 V4.0 Copyright @ Napier University Schema Subqueries Subquery one SELECT statement inside another Used in the WHERE clause Subqueries can return many rows. Subqueries can

More information

Introduction to SQL Server 2005/2008 and Transact SQL

Introduction to SQL Server 2005/2008 and Transact SQL Introduction to SQL Server 2005/2008 and Transact SQL Week 4: Normalization, Creating Tables, and Constraints Some basics of creating tables and databases Steve Stedman - Instructor Steve@SteveStedman.com

More information

LABSHEET 1: creating a table, primary keys and data types

LABSHEET 1: creating a table, primary keys and data types LABSHEET 1: creating a table, primary keys and data types Before you begin, you may want to take a look at the following links to remind yourself of the basics of MySQL and the SQL language. MySQL 5.7

More information

Module 3 MySQL Database. Database Management System

Module 3 MySQL Database. Database Management System Module 3 MySQL Database Module 3 Contains 2 components Individual Assignment Group Assignment BOTH are due on Mon, Feb 19th Read the WIKI before attempting the lab Extensible Networking Platform 1 1 -

More information

SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS. The foundation of good database design

SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS. The foundation of good database design SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS The foundation of good database design Outline 1. Relational Algebra 2. Join 3. Updating/ Copy Table or Parts of Rows 4. Views (Virtual

More information

Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE

Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE COURSE TITLE MTA DATABASE ADMINISTRATOR FUNDAMENTALS COURSE DURATION 10 Hour(s) of Self-Paced Interactive Training COURSE OVERVIEW

More information

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601 Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Database Management System Subject Code: CS 601 Multiple Choice Type Questions 1. Data structure or the data stored

More information

Querying Microsoft SQL Server 2008/2012

Querying Microsoft SQL Server 2008/2012 Querying Microsoft SQL Server 2008/2012 Course 10774A 5 Days Instructor-led, Hands-on Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL

More information

Introductory SQL SQL Joins: Viewing Relationships Pg 1

Introductory SQL SQL Joins: Viewing Relationships Pg 1 Introductory SQL SQL Joins: Viewing Relationships Pg 1 SQL Joins: Viewing Relationships Ray Lockwood Points: The relational model uses foreign keys to establish relationships between tables. SQL uses Joins

More information

EE221 Databases Practicals Manual

EE221 Databases Practicals Manual EE221 Databases Practicals Manual Lab 1 An Introduction to SQL Lab 2 Database Creation and Querying using SQL Assignment Data Analysis, Database Design, Implementation and Relation Normalisation School

More information

DATABASES SQL INFOTEK SOLUTIONS TEAM

DATABASES SQL INFOTEK SOLUTIONS TEAM DATABASES SQL INFOTEK SOLUTIONS TEAM TRAINING@INFOTEK-SOLUTIONS.COM Databases 1. Introduction in databases 2. Relational databases (SQL databases) 3. Database management system (DBMS) 4. Database design

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Course Code: M20761 Vendor: Microsoft Course Overview Duration: 5 RRP: 2,177 Querying Data with Transact-SQL Overview This course is designed to introduce students to Transact-SQL. It is designed in such

More information

Access Basics: When and How

Access Basics: When and How Access Basics: When and How Hal Jankowski CACUBO Winter Workshop Kansas City, MO April 2014 Learning outcome disclaimer Access is a complex tool that requires significant hands on time to become familiar.

More information

Multiple-Choice. 3. When you want to see all of the awards, even those not yet granted to a student, replace JOIN in the following

Multiple-Choice. 3. When you want to see all of the awards, even those not yet granted to a student, replace JOIN in the following Database Design, CSCI 340, Spring 2015 Final, May 12 Multiple-Choice 1. Which of the following is not part of the vocabulary of database keys? (3 pts.) a. Referential key b. Composite key c. Primary key

More information

8) A top-to-bottom relationship among the items in a database is established by a

8) A top-to-bottom relationship among the items in a database is established by a MULTIPLE CHOICE QUESTIONS IN DBMS (unit-1 to unit-4) 1) ER model is used in phase a) conceptual database b) schema refinement c) physical refinement d) applications and security 2) The ER model is relevant

More information

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems CompSci 516 Data Intensive Computing Systems Lecture 21 (optional) NoSQL systems Instructor: Sudeepa Roy Duke CS, Spring 2016 CompSci 516: Data Intensive Computing Systems 1 Key- Value Stores Duke CS,

More information

Chapter 7 PHP Files & MySQL Databases

Chapter 7 PHP Files & MySQL Databases Chapter 7 PHP Files & MySQL Databases At the end of the previous chapter, a simple calendar was displayed with an appointment. This demonstrated again how forms can be used to pass data from one page to

More information

EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2009 Stating Points A database A database management system A miniworld A data model Conceptual model Relational model 2/24/2009

More information

After completing this course, participants will be able to:

After completing this course, participants will be able to: Querying SQL Server T h i s f i v e - d a y i n s t r u c t o r - l e d c o u r s e p r o v i d e s p a r t i c i p a n t s w i t h t h e t e c h n i c a l s k i l l s r e q u i r e d t o w r i t e b a

More information

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept]

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] 1. What is DBMS? A Database Management System (DBMS) is a program that controls creation, maintenance and use

More information

PHP & MySQL Database. Database Systems CSCI Dr. Tom Hicks Computer Science Department

PHP & MySQL Database. Database Systems CSCI Dr. Tom Hicks Computer Science Department PHP & MySQL Database Database Systems CSCI-3343 Dr. Tom Hicks Computer Science Department 1 WWW Organization It Is A Good Idea To Create A Folder For Each Web Page Place Most Items, On Page, In That Folder!

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Course Code: M20461 Vendor: Microsoft Course Overview Duration: 5 RRP: POA Querying Microsoft SQL Server Overview This 5-day instructor led course provides delegates with the technical skills required

More information

"Charting the Course... Intermediate PHP & MySQL Course Summary

Charting the Course... Intermediate PHP & MySQL Course Summary Course Summary Description In this PHP training course, students will learn to create database-driven websites using PHP and MySQL or the database of their choice. The class also covers SQL basics. Objectives

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server 20461 - Querying Microsoft SQL Server Duration: 5 Days Course Price: $2,975 Software Assurance Eligible Course Description About this course This 5-day instructor led course provides students with the

More information

Exam code: Exam name: Database Fundamentals. Version 16.0

Exam code: Exam name: Database Fundamentals. Version 16.0 98-364 Number: 98-364 Passing Score: 800 Time Limit: 120 min File Version: 16.0 Exam code: 98-364 Exam name: Database Fundamentals Version 16.0 98-364 QUESTION 1 You have a table that contains the following

More information

CSCI 403 Database Management. Types of Constraints. Implicit Constraints. Application-Based Constraints. Explicit Constraints 9/9/2018

CSCI 403 Database Management. Types of Constraints. Implicit Constraints. Application-Based Constraints. Explicit Constraints 9/9/2018 CSCI 403 Database Management 8 Constraints, keys, indexes Restrictions on tables CONSTRAINTS 2 Types of Constraints Implicit (model-based) Explicit (schema-based) Application-based Implicit Constraints

More information

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: QUERYING MICROSOFT SQL SERVER Course: 20461C; Duration: 5 Days; Instructor-led WHAT YOU WILL LEARN This 5-day instructor led course provides students with

More information

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7 SQL DATA DEFINITION: KEY CONSTRAINTS CS121: Relational Databases Fall 2017 Lecture 7 Data Definition 2 Covered most of SQL data manipulation operations Continue exploration of SQL data definition features

More information

Non-Relational Databases. Pelle Jakovits

Non-Relational Databases. Pelle Jakovits Non-Relational Databases Pelle Jakovits 25 October 2017 Outline Background Relational model Database scaling The NoSQL Movement CAP Theorem Non-relational data models Key-value Document-oriented Column

More information

Database Management

Database Management Database Management - 2011 Model Answers 1. a. A data model should comprise a structural part, an integrity part and a manipulative part. The relational model provides standard definitions for all three

More information

DB2 SQL Class Outline

DB2 SQL Class Outline DB2 SQL Class Outline The Basics of SQL Introduction Finding Your Current Schema Setting Your Default SCHEMA SELECT * (All Columns) in a Table SELECT Specific Columns in a Table Commas in the Front or

More information

Course Outline Faculty of Computing and Information Technology

Course Outline Faculty of Computing and Information Technology Course Outline Faculty of Computing and Information Technology Title Code Instructor Name Credit Hours Prerequisite Prerequisite Skill/Knowledge/Understanding Category Course Goals Statement of Course

More information

Overview. * Some History. * What is NoSQL? * Why NoSQL? * RDBMS vs NoSQL. * NoSQL Taxonomy. *TowardsNewSQL

Overview. * Some History. * What is NoSQL? * Why NoSQL? * RDBMS vs NoSQL. * NoSQL Taxonomy. *TowardsNewSQL * Some History * What is NoSQL? * Why NoSQL? * RDBMS vs NoSQL * NoSQL Taxonomy * Towards NewSQL Overview * Some History * What is NoSQL? * Why NoSQL? * RDBMS vs NoSQL * NoSQL Taxonomy *TowardsNewSQL NoSQL

More information

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL Databases Topics History - RDBMS - SQL Architecture - SQL - NoSQL MongoDB, Mongoose Persistent Data Storage What features do we want in a persistent data storage system? We have been using text files to

More information

OVERVIEW OF RELATIONAL DATABASES: KEYS

OVERVIEW OF RELATIONAL DATABASES: KEYS OVERVIEW OF RELATIONAL DATABASES: KEYS Keys (typically called ID s in the Sierra Database) come in two varieties, and they define the relationship between tables. Primary Key Foreign Key OVERVIEW OF DATABASE

More information

COURSE OUTLINE: Querying Microsoft SQL Server

COURSE OUTLINE: Querying Microsoft SQL Server Course Name 20461 Querying Microsoft SQL Server Course Duration 5 Days Course Structure Instructor-Led (Classroom) Course Overview This 5-day instructor led course provides students with the technical

More information

LAB 3 Part 1 ADBC - Interactive SQL Queries-Advanced

LAB 3 Part 1 ADBC - Interactive SQL Queries-Advanced LAB 3 Part 1 ADBC - Interactive SQL Queries-Advanced ***For each question Create the SQL query that solves the problem Write all SQL statements in the same script file and save into a text file called

More information

Querying Data with Transact-SQL (20761)

Querying Data with Transact-SQL (20761) Querying Data with Transact-SQL (20761) Formato do curso: Presencial e Live Training Preço: 1630 Nível: Iniciado Duração: 35 horas The main purpose of this 5 day instructor led course is to give students

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and

More information

CPS 510 Data Base I. There are 3 forms of database descriptions the ANSI/SPARK, 1975 and so on

CPS 510 Data Base I. There are 3 forms of database descriptions the ANSI/SPARK, 1975 and so on Introduction DBMS 1957 A database can be defined as a set of Master files, organized & administered in a flexible way, so that the files in the database can be easily adapted to new unforeseen tasks! Relation

More information

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations Show Only certain columns and rows from the join of Table A with Table B The implementation of table operations

More information

CSC 3300 Homework 3 Security & Languages

CSC 3300 Homework 3 Security & Languages CSC 3300 Homework 3 Security & Languages Description Homework 3 has two parts. Part 1 is an exercise in database security. In particular, Part 1 has practice problems in which your will add constraints

More information

Announcements. Joins in SQL. Joins in SQL. (Inner) joins. Joins in SQL. Introduction to Database Systems CSE 414

Announcements. Joins in SQL. Joins in SQL. (Inner) joins. Joins in SQL. Introduction to Database Systems CSE 414 Announcements Introduction to Database Sstems CSE 414 Lecture 4: SQL Joins and Aggregates WQ1 due on Tuesda No late das allowed HW1 due on Tuesda Submit using script in repo WQ2 and HW2 will be out tomorrow

More information

Lecture 13: MySQL and PHP. Monday, March 26, 2018

Lecture 13: MySQL and PHP. Monday, March 26, 2018 Lecture 13: MySQL and PHP Monday, March 26, 2018 MySQL The Old Way In older versions of PHP, we typically used functions that started with mysql_ that did not belong to a class For example: o o o o mysql_connect()

More information

CS6302 DBMS 2MARK & 16 MARK UNIT II SQL & QUERY ORTIMIZATION 1. Define Aggregate Functions in SQL? Aggregate function are functions that take a collection of values as input and return a single value.

More information

20461: Querying Microsoft SQL Server

20461: Querying Microsoft SQL Server 20461: Querying Microsoft SQL Server Length: 5 days Audience: IT Professionals Level: 300 OVERVIEW This 5 day instructor led course provides students with the technical skills required to write basic Transact

More information

In SQL window, type SHOW TABLE STATUS; and discuss INNODB vs. MyISAM (foreign key support; transactions; row-level locking)

In SQL window, type SHOW TABLE STATUS; and discuss INNODB vs. MyISAM (foreign key support; transactions; row-level locking) Comp 453 Lab #1 Look at COMPANY schema login to local PHPMyAdmin Run Wamp/MampServer Open PHPMyAdmin Click on NEW in left menu bar click on SQL tab on top CREATE DATABASE COMPANY; See the company DB in

More information

Course 20461C: Querying Microsoft SQL Server

Course 20461C: Querying Microsoft SQL Server Course 20461C: Querying Microsoft SQL Server Audience Profile About this Course This course is the foundation for all SQL Serverrelated disciplines; namely, Database Administration, Database Development

More information

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 6 Using Subqueries and Set Operators Eng. Alaa O Shama November, 2015 Objectives:

More information

Relational Database Model. III. Introduction to the Relational Database Model. Relational Database Model. Relational Terminology.

Relational Database Model. III. Introduction to the Relational Database Model. Relational Database Model. Relational Terminology. III. Introduction to the Relational Database Model Relational Database Model In 1970, E. F. Codd published A Relational Model of Data for Large Shared Data Banks in CACM. In the early 1980s, commercially

More information

20761 Querying Data with Transact SQL

20761 Querying Data with Transact SQL Course Overview The main purpose of this course is to give students a good understanding of the Transact-SQL language which is used by all SQL Server-related disciplines; namely, Database Administration,

More information

End o' semester clean up. A little bit of everything

End o' semester clean up. A little bit of everything End o' semester clean up A little bit of everything Database Optimization Two approaches... what do you think they are? Improve the Hardware Has been a great solution in recent decades, thanks Moore! Throwing

More information

Comparing SQL and NOSQL databases

Comparing SQL and NOSQL databases COSC 6397 Big Data Analytics Data Formats (II) HBase Edgar Gabriel Spring 2014 Comparing SQL and NOSQL databases Types Development History Data Storage Model SQL One type (SQL database) with minor variations

More information

Relational Data Structure and Concepts. Structured Query Language (Part 1) The Entity Integrity Rules. Relational Data Structure and Concepts

Relational Data Structure and Concepts. Structured Query Language (Part 1) The Entity Integrity Rules. Relational Data Structure and Concepts Relational Data Structure and Concepts Structured Query Language (Part 1) Two-dimensional tables whose attributes values are atomic. At every row-and-column position within the table, there always exists

More information

AVANTUS TRAINING PTE LTD

AVANTUS TRAINING PTE LTD [MS20461]: Querying Microsoft SQL Server 2014 Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview This 5-day

More information

Modern Database Systems CS-E4610

Modern Database Systems CS-E4610 Modern Database Systems CS-E4610 Aristides Gionis Michael Mathioudakis Spring 2017 what is a database? a collection of data what is a database management system?... a.k.a. database system software to store,

More information

MongoDB An Overview. 21-Oct Socrates

MongoDB An Overview. 21-Oct Socrates MongoDB An Overview 21-Oct-2016 Socrates Agenda What is NoSQL DB? Types of NoSQL DBs DBMS and MongoDB Comparison Why MongoDB? MongoDB Architecture Storage Engines Data Model Query Language Security Data

More information

HKTA TANG HIN MEMORIAL SECONDARY SCHOOL SECONDARY 3 COMPUTER LITERACY. Name: ( ) Class: Date: Databases and Microsoft Access

HKTA TANG HIN MEMORIAL SECONDARY SCHOOL SECONDARY 3 COMPUTER LITERACY. Name: ( ) Class: Date: Databases and Microsoft Access Databases and Microsoft Access Introduction to Databases A well-designed database enables huge data storage and efficient data retrieval. Term Database Table Record Field Primary key Index Meaning A organized

More information

COMP519: Web Programming Autumn 2015

COMP519: Web Programming Autumn 2015 COMP519: Web Programming Autumn 2015 In the next lectures you will learn What is SQL How to access mysql database How to create a basic mysql database How to use some basic queries How to use PHP and mysql

More information

A Sample Solution to the Midterm Test

A Sample Solution to the Midterm Test CS3600.1 Introduction to Database System Fall 2016 Dr. Zhizhang Shen A Sample Solution to the Midterm Test 1. A couple of W s(10) (a) Why is it the case that, by default, there are no duplicated tuples

More information

Querying Microsoft SQL Server 2012/2014

Querying Microsoft SQL Server 2012/2014 Page 1 of 14 Overview This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2014. This course is the foundation

More information

MySQL for Developers Ed 3

MySQL for Developers Ed 3 Oracle University Contact Us: 0845 777 7711 MySQL for Developers Ed 3 Duration: 5 Days What you will learn This MySQL for Developers training teaches developers how to plan, design and implement applications

More information

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases Key-Value Document Column Family Graph John Edgar 2 Relational databases are the prevalent solution

More information

MySQL for Developers Ed 3

MySQL for Developers Ed 3 Oracle University Contact Us: 1.800.529.0165 MySQL for Developers Ed 3 Duration: 5 Days What you will learn This MySQL for Developers training teaches developers how to plan, design and implement applications

More information

Normalization in DBMS

Normalization in DBMS Unit 4: Normalization 4.1. Need of Normalization (Consequences of Bad Design-Insert, Update & Delete Anomalies) 4.2. Normalization 4.2.1. First Normal Form 4.2.2. Second Normal Form 4.2.3. Third Normal

More information

MIS NETWORK ADMINISTRATOR PROGRAM

MIS NETWORK ADMINISTRATOR PROGRAM NH107-7475 SQL: Querying and Administering SQL Server 2012-2014 136 Total Hours 97 Theory Hours 39 Lab Hours COURSE TITLE: SQL: Querying and Administering SQL Server 2012-2014 PREREQUISITE: Before attending

More information

MySQL by Examples for Beginners

MySQL by Examples for Beginners yet another insignificant programming notes... HOME MySQL by Examples for Beginners Read "How to Install MySQL and Get Started" on how to install, customize, and get started with MySQL. 1. Summary of MySQL

More information

YeSQL: Battling the NoSQL Hype Cycle with Postgres

YeSQL: Battling the NoSQL Hype Cycle with Postgres YeSQL: Battling the NoSQL Hype Cycle with Postgres BRUCE MOMJIAN This talk explores how new NoSQL technologies are unique, and how existing relational database systems like Postgres are adapting to handle

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Querying Microsoft SQL Server Duration: 5 Days (08:30-16:00) Overview: This course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server. This

More information

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

L12: ER modeling 5. CS3200 Database design (sp18 s2)   2/22/2018 L12: ER modeling 5 CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/22/2018 200 Announcements! Keep bringing your name plates J Exam 1 discussion: questions on grading: Piazza,

More information

Why NoSQL? Why Riak?

Why NoSQL? Why Riak? Why NoSQL? Why Riak? Justin Sheehy justin@basho.com 1 What's all of this NoSQL nonsense? Riak Voldemort HBase MongoDB Neo4j Cassandra CouchDB Membase Redis (and the list goes on...) 2 What went wrong with

More information

Advance Database Systems. Joining Concepts in Advanced SQL Lecture# 4

Advance Database Systems. Joining Concepts in Advanced SQL Lecture# 4 Advance Database Systems Joining Concepts in Advanced SQL Lecture# 4 Lecture 4: Joining Concepts in Advanced SQL Join Cross Join Inner Join Outer Join 3 Join 4 Join A SQL join clause combines records from

More information

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus

CSCI-UA: Database Design & Web Implementation. Professor Evan Sandhaus CSCI-UA:0060-02 Database Design & Web Implementation Professor Evan Sandhaus sandhaus@cs.nyu.edu evan@nytimes.com Lecture #28: This is the end - the only end my friends. Database Design and Web Implementation

More information

A NoSQL Introduction for Relational Database Developers. Andrew Karcher Las Vegas SQL Saturday September 12th, 2015

A NoSQL Introduction for Relational Database Developers. Andrew Karcher Las Vegas SQL Saturday September 12th, 2015 A NoSQL Introduction for Relational Database Developers Andrew Karcher Las Vegas SQL Saturday September 12th, 2015 About Me http://www.andrewkarcher.com Twitter: @akarcher LinkedIn, Twitter Email: akarcher@gmail.com

More information