1 / 11

Chapter 4

Chapter 4. Introduction to MySQL. MySQL. “the world’s most popular open-source database application” “commonly used with PHP”. Relational Database. On cscdb.nku.edu, you have a database db_username (ex. db_frank ) Collection of tables look like Excel spreadsheets.

argus
Download Presentation

Chapter 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4 Introduction to MySQL

  2. MySQL • “the world’s most popular open-source database application” • “commonly used with PHP”

  3. Relational Database • On cscdb.nku.edu, you have a database db_username (ex. db_frank) • Collection of tables • look like Excel spreadsheets

  4. Relational DB Concepts: Tables • Each table represents a class of objects = a set of objects of the same type / kind • E.g. customers, orders • Table Customers in the db for Book-O-Rama store (running example): • A table has: • A name – Customers • Structure = a number of columns – customerid, name, address, city • Rows – currently, data about 3 customers in this table

  5. bookorama.sql • Tables • customers • orders • books • order_items • book_reviews

  6. MySQL Data Types • CHAR(50) – fixed length character field • TEXT – string with maximum length 65,535 characters • INT – integer • TINYINT – 1 byte integer (signed -128..127, unsigned 0..255)

  7. MySQL Data Types • FLOAT(6,2) - floating point – 6 digits, 2 decimal places • DATE – YYYY-MM-DD • TIMESTAMP – YYYYMMDDHHMMSS (when UPDATE or INSERT is performed) • DOUBLE(10,2) – larger floating point – 10 digits, 2 decimal places

  8. MySQL Data Types • DECIMAL(7,2) – for accurate dollars and cents calculations • ENUM(‘M’,’F’) – enumeration of values

  9. COLUMN PROPERTIES • UNSIGNED- positive numbers and zero • NOT NULL • NULL = no value • Must have a value • PRIMARY KEY • Unique • Social Security Number • ISBN

  10. COLUMN PROPERTIES • AUTOINCREMNT PRIMARY KEY • 1, 2, 3, 4, … - assign each record an id

  11. MySQL Client • mysql.exe • mysql –h cscdb.nku.edu – u username –p

More Related