Information Building and Retrieval Using MySQL - PowerPoint PPT Presentation

About This Presentation
Title:

Information Building and Retrieval Using MySQL

Description:

and Retrieval Using MySQL. Track 3 : Basic Course in Database. Learning Objectives ... are db and host. edit Edit command with $EDITOR. exit Exit mysql. Same as quit ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 13
Provided by: awo9
Learn more at: http://www.aworc.org
Category:

less

Transcript and Presenter's Notes

Title: Information Building and Retrieval Using MySQL


1
Information Building and Retrieval Using MySQL
  • Track 3 Basic Course in Database

2
Learning Objectives
  • At the end of the session, you should be
    able to
  • Understand Structured Query Language
  • Write data definition SQL statements to create
    database objects like table, index, and view
  • Write data manipulation SQL statements to add,
    edit, delete records
  • Write data manipulation SQL statement to retrieve
    information from a database
  • Use MySQL in developing a database

3
SQL BASICS
  • SQL
  • derived from Structured Query Language
  • most known and developed language that uses
    relational database operations (e.g. select,
    project, join, union, intersection, and
    difference)

4
SQL BASICS
  • 2 SQL Categories
  • Data Definition Language (DDL)
  • used to define database and its objects (e.g.
    table, index, view)
  • Data Manipulation Language (DML)
  • used to manipulate database objects

5
Data Definition Language
  • CREATE DATABASE
  • PURPOSE To create a database with the
    given name.
  • SYNTAX
  • CREATE DATABASE ltdb_namegt

6
Data Definition Language
  • CREATE TABLE
  • PURPOSE To create the table with the given name
    in the current database and define its
    columns and constraints.
  • SYNTAX
  • CREATE TEMPORARY TABLE lttable namegt (ltcol_namegt
    ltcolumn typegt ltcolumn_constraintgt
  • ,ltcolumn namegt ltcolumn typegt ltattribute
    constraintgt)
  • lttable_optionsgt select_statement

7
Data Manipulation Language
  • INSERT
  • PURPOSE To add rows into an existing table.
    SYNTAX
  • INSERT INTO lttbl_namegt (ltcol_namegt,...)
  • VALUES (ltexpressiongt,...),(...),...
  • or INSERT INTO lttbl_namegt (ltcol_namegt,...)
  • SELECT ...

8
Data Manipulation Language
  • UPDATE
  • PURPOSE To update columns in existing table
    rows with new values.
  • SYNTAX
  • UPDATE tbl_name SET
  • col_name1expr1,
  • col_name2expr2,...WHERE
  • where_definition

9
Data Manipulation Language
  • DELETE
  • PURPOSE To delete rows from tbl_name that
    satisfy the condition given by where_definition
  • Caution If you issue a DELETE with no WHERE
    clause, all rows are deleted.
  • SYNTAX
  • DELETE FROM tbl_name
  • WHERE where_definition LIMIT rows

10
Data Manipulation Language
  • SELECT
  • PURPOSE To retrieve rows selected from one or
    more tables. select_expression
    indicates the columns you want to retrieve.

11
Data Manipulation Language
  • SELECT
  • SYNTAX
  • SELECT DISTINCTDISTINCTROWALL
  • select_expression,...
  • FROM table_references
  • WHERE where_definition
  • GROUP BY col_name,...
  • HAVING where_definition
  • ORDER BY unsigned_integer col_name
    formula ASC DESC ,...

12
Workshop using mysql
  • MySQL commands
  • help Display this text
  • ? Synonym for help'
  • clear Clear command
  • connect Reconnect to the server. Optional
    arguments
  • are db and host
  • edit Edit command with EDITOR
  • exit Exit mysql. Same as quit
  • go Send command to mysql server
  • quit Quit mysql
  • source Execute a SQL script file. Takes a
    file
  • name as an argument
  • status Get status information from the
    server
  • use Use another database. Takes database
    name
  • as argument
Write a Comment
User Comments (0)
About PowerShow.com