MySQL Crash Course, Chapter 1

2,231 views

Published on

MySQL Crash Course, Chapter 1

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,231
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
35
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MySQL Crash Course, Chapter 1

  1. 1. MySQL Crash Course Chapter 01 Understanding SQL Author: Ben Forta | Publisher: Sams Publishing Copyright 2010
  2. 2. What is a Database? <ul><li>A database is a collection of data stored in some organized fashion </li></ul><ul><ul><li>simply a physical location to store data </li></ul></ul><ul><li>Database software is called the Relational Database Management System (RMDBS) </li></ul><ul><ul><li>the database is the container created and manipulated via the RDBMS </li></ul></ul>Copyright 2010
  3. 3. Common RDBMSs <ul><li>The most common database software programs are: </li></ul><ul><ul><li>Oracle </li></ul></ul><ul><ul><li>Microsoft SQL Server </li></ul></ul><ul><ul><li>IBM DB2 </li></ul></ul><ul><ul><li>MySQL </li></ul></ul><ul><ul><li>Postgre SQL </li></ul></ul>Copyright 2010
  4. 4. Tables <ul><li>A database consists of tables that are interrelated (thus relational database) </li></ul><ul><ul><li>just like a website consists of web pages that are linked </li></ul></ul>Copyright 2010
  5. 5. Tables Example <ul><li>One table stores information about customers </li></ul><ul><ul><li>table called customers </li></ul></ul><ul><li>Another table stores information about customer orders </li></ul><ul><ul><li>table called orders </li></ul></ul>Copyright 2010
  6. 6. Schema <ul><li>A schema is a set of information that describes a table </li></ul>Copyright 2010
  7. 7. Columns and Datatypes <ul><li>Table are made up of columns </li></ul><ul><li>Columns are referred to as fields </li></ul><ul><li>A field contains a particular piece of information </li></ul><ul><ul><li>column equals field </li></ul></ul>Copyright 2010
  8. 8. Columns and Datatypes <ul><li>Example: table named customers </li></ul><ul><li>Note: each field should hold distinct information (for example, name should be split into two fields, one for first name , one for last name .) </li></ul>Copyright 2010 city address name ??? etc. »
  9. 9. Columns and Datatypes <ul><li>Each column in a database has an associated datatype </li></ul><ul><ul><li>allows only specific data in that column </li></ul></ul><ul><ul><li>helps store data correctly </li></ul></ul><ul><ul><li>specified when table is created </li></ul></ul><ul><li>Example: </li></ul><ul><ul><li>a field called price would only store data that looks like “19.99” and not “Boston” </li></ul></ul>Copyright 2010
  10. 10. Rows <ul><li>Data in a table is stored in rows </li></ul><ul><ul><li>a row is a record in a table </li></ul></ul><ul><li>Example: a customers table might store information about one customer in one row </li></ul><ul><ul><li>row equals record </li></ul></ul>Copyright 2010
  11. 11. Primary Keys <ul><li>Every row in a table should have some column (or set of columns) that uniquely identifies it, called the primary key </li></ul><ul><ul><li>used to refer to a specific row </li></ul></ul>Copyright 2010
  12. 12. Primary Keys <ul><li>Example: table named customers </li></ul><ul><li>primary key (unique value per row) </li></ul>Copyright 2010 274 Moody Street address » Kery name_last Peter name_first 001 id
  13. 13. Primary Keys <ul><li>Best Practices (Don’ts) </li></ul><ul><li>Don’t update values in primary key columns </li></ul><ul><li>Don’t reuse values in primary key columns </li></ul><ul><li>Don’t use values that might change in primary key columns </li></ul>Copyright 2010
  14. 14. What is SQL? <ul><li>SQL is a language designed specifically for communicating with databases </li></ul><ul><ul><li>acronym for Structured Query Language </li></ul></ul><ul><ul><li>pronounced as the letters S-Q-L or as “sequel” </li></ul></ul>Copyright 2010
  15. 15. What is SQL? <ul><li>Advantages of SQL </li></ul><ul><ul><li>every major RMDBS supports SQL </li></ul></ul><ul><ul><li>learning one language enables you to interact with many databases </li></ul></ul><ul><ul><li>SQL is made up of description English words, and there aren’t that many of them, therefore . . . </li></ul></ul><ul><ul><li>SQL is not difficult to learn </li></ul></ul>Copyright 2010
  16. 16. What is SQL? <ul><li>Disadvantages of SQL </li></ul><ul><ul><li>no two RDBMSs implement SQL identically </li></ul></ul><ul><ul><li>just like no two browsers implement HTML and CSS identically </li></ul></ul>Copyright 2010
  17. 17. MySQL Crash Course <ul><li>Go to TechSkillsWork.com </li></ul>FOR MORE INFO... Copyright 2010

×