Download Document 7760007

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Object-relational impedance mismatch wikipedia, lookup

Microsoft SQL Server wikipedia, lookup

Clusterpoint wikipedia, lookup

Open Database Connectivity wikipedia, lookup

Relational model wikipedia, lookup

Database model wikipedia, lookup

Transcript
Getting Started with MySQL
PHP code would take care of the rest, automatically displaying the new joke
along with the others when it fetched the list from the database.
Let's run with this example as we look at how data is stored in a database. A
database is composed of one or more tables, each of which contains a list of
things. For our joke database, we'd probably start with a table called Jokes that
would contain a list of jokes. Each table in a database has one or more columns,
or fields. Each column holds a certain piece of information about each item in
the table. In our example, our Jokes table might have columns for the text of the
jokes, and the dates on which the jokes were added to the database. Each joke
that we stored in this table would then be said to be a row in the table. These
rows and columns form a table that looks like Figure 2.1.
Figure 2.1. Structure of a typical database table
Notice that, in addition to columns for the joke text (JokeText) and the date of
the joke (JokeDate), I included a column named ID. As a matter of good design,
a database table should always provide a way to identify uniquely each of its
rows. Since it's possible that a single joke could be entered more than once on
the same date, the JokeText and JokeDate columns can't be relied upon to tell
all the jokes apart. The function of the ID column, therefore, is to assign a unique
number to each joke, so we have an easy way to refer to them, and to keep track
of which joke is which. Such database design issues will be covered in greater
depth in Chapter 5.
So, to review, the above is a three-column table with two rows, or entries. Each
row in the table contains three fields, one for each column in the table: the joke's
ID, its text, and the date of the joke. With this basic terminology under our belts,
we're ready to get started with MySQL.
36