MySQL Explain examples

Slides:



Advertisements
Similar presentations
1 I Esempio di constraints. 2 DROP TABLE regions; CREATE TABLE regions ( region_id NUMBER CONSTRAINT region_id_nn NOT NULL, region_name VARCHAR2(25) );
Advertisements

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.
Presented by, MySQL AB® & O’Reilly Media, Inc. Applied Partitioning and Scaling Your (OLTP) Database System Phil Hildebrand thePlatform.
Module 4: Creating Data Types and Tables. Overview Creating Data Types Creating Tables Generating Column Values Generating Scripts.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2010 All Rights Reserved.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
Sarah Sproehnle Cloudera, Inc
DATA MODELING AND DATABASE DESIGN
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
Advanced Database Management System
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
Module 3: Creating Data Types and Tables. Overview Working with Data Types Working with Tables Generating Column Values Generating Scripts.
Recap of SQL Lab no 8 Advance Database Management System.
Intro to SQL| MIS 2502  Spacing not relevant › BUT… no spaces in an attribute name or table name  Oracle commands keywords, table names, and attribute.
RDBMS MySQL. MySQL is a Relational Database Management System MySQL allows multiple tables to be related to each other. Similar to a Grandparent to a.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
1 MySQL and SQL. 2 Topics  Introducing Relational Databases  Terminology  Managing Databases MySQL and SQL.
Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2015, Fred McClurg, All Rights.
At the end of this lesson, you will be able to: Describe constraints Create and maintain constraints.
CREATE TABLE ARTIST ( ArtistID int NOT NULL IDENTITY (1,1), Namechar(25) NOT NULL, TEXT ERROR Nationality char (30) NULL, Birthdate numeric (4,0) NULL,
LAB: Web-scale Data Management on a Cloud Lab 11. Query Execution Plan 2011/05/27.
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
MS SQL Create Table Cust USE jxc00 GO CREATE TABLE cust ( cust_id smallint IDENTITY(1,1) NOT NULL, cust_name char(10)
Creating Indexes Database Systems Objectives Distinguish between the indexes that are created automatically and those that are created manually.
Bend SQL to Your Will With EXPLAIN Ligaya Turmelle MySQL Support Engineer
CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0.
1 Copyright 2009 Sun Microsystems Inc. The World’s Most Popular Open Source Database How MySQL.com Improved their Database Performance with Query Analyzer.
SQL - Training Rajesh Charles. Agenda (Complete Course) Introduction Testing Methodologies Manual Testing Practical Workshop Automation Testing Practical.
Partitioning Sheeri K. Cabral Database Administrator The Pythian Group, January 12, 2009.
Utilization of Data Maryland Highway Safety office/Washington College
Tables & Relationships
SQL Relational Database Project
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Insert, Update and the rest…
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Mailboxes and MySQL at Zimbra
Optimizing MySQL Joins and Subqueries
Referential Integrity MySQL
All Powder Board and Ski
Data Modeling and Database Design
Implementation of Entity Relationships
ETL Processing Mechanics of ETL.
Structured Query Language (Data definition Language)
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Introduction to Computer Science (CIS 101)
لغة قواعد البيانات STRUCTURED QUERY LANGUAGE SQL))
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
These are slides from Dr. Phil Cannata’s Class
CS122 Using Relational Databases and SQL
Rob Gleasure robgleasure.com
Geo/Spatial Search with MySQL
Data Definition Language
Data Definition Language
Chapter # 7 Introduction to Structured Query Language (SQL) Part I.
Chapter 4 Introduction to MySQL.
CS122 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
Instructor: Samia arshad
CS122 Using Relational Databases and SQL
ETL Processing Mechanics of ETL.
SQLDeveloper Data Modeler - Logical Model
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
SQL NOT NULL Constraint
SQL (Structured Query Language)
Presentation transcript:

MySQL Explain examples

create table customers ( custid integer primary key, renew date, magid int ); create table magazines ( magid int primary key, cost int ); select sum(cost) from magazines where magid in (select magid from customers); select sum(cost) from customers join magazines on customers.magid = magazines.magid;

create table customers ( custid integer primary key, renew date, magid int ); create table magazines ( magid int primary key, cost int ); alter table customers add constraint foreign key(magid) references magazines(magid); select sum(cost) from magazines where magid in ( select magid from customers ); select sum(cost) from customers join magazines on customers.magid = magazines.magid;

Using index; FirstMatch(magazines) create table customers ( custid integer primary key, renew date, magid int ); create table magazines ( magid int primary key, cost int ); alter table customers add constraint foreign key(magid) references magazines(magid); select sum(cost) from magazines where magid in ( select magid from customers ); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE magazines index PRIMARY,FK2 FK2 9 NULL Using index customers FK1 5 magazines.magid Using index; FirstMatch(magazines)