A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.

Slides:



Advertisements
Similar presentations
Session 2Introduction to Database Technology Data Types and Table Creation.
Advertisements

Developing an Excel Application
Tutorial 8: Developing an Excel Application
Tonight’s Lecture chapter 3. A Guide to MySQL2 Using MySQL Reference Manual to Get Help Can access online
Access Lesson 2 Creating a Database
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
XP New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 11 1 Microsoft Office Excel 2003 Tutorial 11 – Importing Data Into Excel.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Concepts of Database Management Sixth Edition
Concepts of Database Management, 4th Edition, Pratt & Adamski
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
Concepts of Database Management Sixth Edition
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
1 An Introduction to SQL. 2 Objectives  Understand the concepts and terminology associated with relational databases  Create and run SQL commands 
ASP.NET Programming with C# and SQL Server First Edition
Concepts of Database Management Seventh Edition
Chapter 1 Databases and Database Objects: An Introduction
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
CSC 2720 Building Web Applications Database and SQL.
Microsoft Office 2007 Access Chapter 6 Using Macros, Switchboards, PivotTables, and PivotCharts.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
CS 3630 Database Design and Implementation. Assignment 3 Style! Agreement between database designer and the client. UserName1_EasyDrive UserName2_EasyDrive.
1 A Guide to SQL Chapter 2. 2 Introduction Mid-1970s: SQL developed under the name SEQUEL at IBM by San Jose research facilities to be the data manipulation.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
Unit 5 Microsoft SQL Server and MySQL. Key Concepts DBMS variations SQL Server features SQL Server Management Studio MySQL features Scripts Queries Database.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
A Guide to SQL, Seventh Edition. Objectives Understand how to use functions in queries Use the UPPER and LOWER functions with character data Use the ROUND.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Ennis-Cole, AC 2.01, CECS Maintaining A Database By: Dr. Ennis-Cole.
Basic SQL*Plus edit and execute commands SQL*Plus buffer and built-in editor holds the last SQL statement Statements are created in free-flow style and.
A Guide to MySQL 6. 2 Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT command.
A Guide to SQL, Sixth Edition 1 Chapter 5 Updating Data.
Chapter 3 Table Creation and Management Oracle 10g: SQL.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
 CONACT UC:  Magnific training   
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
3 A Guide to MySQL.
Retrieving Data Using the SQL SELECT Statement
CS 3630 Database Design and Implementation
A Guide to SQL, Seventh Edition
SQL and SQL*Plus Interaction
Developing an Excel Application
Using SQL*Plus.
ORACLE SQL Developer & SQLPLUS Statements
Chapter 2: Creating And Modifying Database Tables
Using SQL*Plus.
Presentation transcript:

A Guide to MySQL 3

2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed in mid-1970s under the name SEQUEL Renamed SQL in 1980 Used by most DBMSs

A Guide to MySQL 3 Starting MySQL  Windows XP Click Start button Point to All Programs Point to MySQL on menu Point to MySQL Server 4.1 Click MySQL Command Line Client  Must enter password in Command Line Client window

A Guide to MySQL 4 Obtaining Help in MySQL  Type \h at MySQL> prompt  Type “help” followed by name of command help contents help union

A Guide to MySQL 5

6

7 Creating a Database  Must create a database before creating tables  Use CREATE DATABASE command  Include database name

A Guide to MySQL 8 Changing the Default Database  Default database: database to which all subsequent commands pertain  USE command, followed by database name: Changes the default database Execute at the start of every session

A Guide to MySQL 9 Creating a Table  Describe the layout of each table in the database  Use CREATE TABLE command  TABLE is followed by the table name  Follow this with the names and data types of the columns in the table  Data types define type and size of data

A Guide to MySQL 10 Table and Column Name Restrictions  Names cannot exceed 18 characters  Must start with a letter  Can contain letters, numbers, and underscores (_)  Cannot contain spaces

A Guide to MySQL 11 Creating the REP Table

A Guide to MySQL 12 Entering Commands in MySQL  Commands are free-format; no rules stating specific words in specific positions  Press ENTER to move to the next line in a command  Indicate the end of a command by typing a semicolon  Commands are not case sensitive

A Guide to MySQL 13 Running SQL Commands

A Guide to MySQL 14 Editing SQL Commands  Statement history: stores most recently used command  Editing commands: Use arrow keys to move up, down, left, and right Use Ctrl+A to move to beginning of line Use Ctrl+E to move to end of line Use Backspace and Delete keys

A Guide to MySQL 15 Errors in SQL Commands

A Guide to MySQL 16 Editing MySQL Commands  Press Up arrow key to go to top line  Press Enter key to move to next line if line is correct  Use Right and Left arrow keys to move to location of error  Press ENTER key when line is correct  If Enter is not pressed on a line, line not part of the revised command

A Guide to MySQL 17 Dropping a Table  Can correct errors by dropping (deleting) a table and starting over  Useful when table is created before errors are discovered  Command is followed by the table to be dropped and a semicolon  Any data in table also deleted

A Guide to MySQL 18 Data Types  For each table column, type of data must be defined  Common data types: CHAR(n) VARCHAR(n) DATE DECIMAL(p,q) INT SMALLINT

A Guide to MySQL 19 Nulls  A special value to represent situation when actual value is not known for a column  Can specify whether to allow nulls in the individual columns  Should not allow nulls for primary key columns

A Guide to MySQL 20 Implementation of Nulls  Use NOT NULL clause in CREATE TABLE command to exclude the use of nulls in a column  Default is to allow null values  If a column is defined as NOT NULL, system will reject any attempt to store a null value there

A Guide to MySQL 21 Adding Rows to a Table  INSERT command : INSERT INTO followed by table name VALUES command followed by specific values in parentheses Values for character columns in single quotation marks

A Guide to MySQL 22 The Insert Command To add new rows modify previous INSERT command Use same editing techniques as those used to correct errors

A Guide to MySQL 23 Adding Additional Rows

A Guide to MySQL 24 The INSERT Command with Nulls  Use a special format of INSERT command to enter a null value in a table  Identify the names of the columns that accept non-null values, then list only the non-null values after the VALUES command  Enter only non-null values  Precisely indicate values you are entering by listing the columns

A Guide to MySQL 25 The INSERT Command with Nulls (continued)

A Guide to MySQL 26 Viewing Table Data  Use SELECT command to display all the rows and columns in a table  SELECT * FROM followed by the name of the table  Ends with a semicolon

A Guide to MySQL 27 Viewing Table Data (continued)

A Guide to MySQL 28 Correcting Errors In the Database  UPDATE command is used to update a value in a table  DELETE command allows you to delete a record  INSERT command allows you to add a record

A Guide to MySQL 29 Correcting Errors in the Database (continued)

A Guide to MySQL 30 Correcting Errors in the Database (continued)

A Guide to MySQL 31 Saving SQL Commands  Allows you to use commands again without retyping  Different methods for each SQL implementation you are using Oracle SQL*Plus and SQL*Plus Worksheet use a script file Access saves queries as objects MySQL uses an editor to save text files

A Guide to MySQL 32 Saving SQL Commands  Script file: File containing SQL commands Use a text editor or word processor to create Save with a.txt file name extension Run in MySQL:  SOURCE file name  \. file name Include full path if file is in folder other than default

A Guide to MySQL 33 Creating the Remaining Database Tables  Execute appropriate CREATE TABLE and INSERT commands  Save these commands to a secondary storage device

A Guide to MySQL 34 Describing a Table