How can database be created




















Databases , Office Apps. The work reached its low point when I was given the job of renumbering — by hand — 30, filecards. The cards were numbered from 1 to 30, and the powers that be wanted them renumbered 0 to 29, so that each batch of cards would start with the same digits. If only those filecards had been on a computer database! With a computer, this mind-numbing job, which took me several weeks to complete, could have been done in a matter of seconds. In fact, it would have been an utterly trivial task.

Unfortunately, at the time I was suffering in the Stamp Duties Office, in the mids, computer databases as we know them today were in their infancy. In the mids, however, computer databases — particularly in the hands of end users — were not a common thing.

Although riddled with bugs, dBASE put enormous power into the hands of microcomputer developers and it remained the pre-eminent database program until the advent of Windows 3. Today, there are many database products to choose from, ranging from programs designed for developers to simple databases for average computer users to niche databases designed for specific purposes, such as library catalogues and classroom scheduling. Databases excel at managing and manipulating structured information. Consider one of the most familiar databases — the phone book.

The phone book contains several items of information — name, address and phone number — about each phone subscriber in a particular area. In database parlance, the phone book is a table which contains a record for each subscriber. Each subscriber record contains three fields : name, address, and phone number. Each field contains a specific piece of information about the subscriber.

The third column in the preceding results, Null , indicates whether each field may contain NULL values. This is different from blank or empty content in a field. The fourth column, Key , indicates whether a field is a key field—an indexed column. If a column is indexed, the display will say which kind of index. Because of the limited space permitted in the display, it truncates the words.

The next-to-last column in the display, Default , would contain any default value set for each field. We can do that later. The last column, Extra , provides any extra information the table maintains on each column. If you made some mistakes and just want to start over, you can delete the table and try again to create it.

Incidentally, when using the mysql client, you can press the up arrow on your keyboard to get to the previous lines you entered. So if you create a table, then run the DESCRIBE statement and catch a mistake, you can just drop the table, and use the up arrow to go back to your previous entry in which you created the table.

Use the left arrow to move the cursor over to the text you want to change and fix it. Those were a lot of details to absorb in the last section. Just enter the following on your server using the mysql client:. This will create six rows of data for six birds. Enter the following from the mysql client to see the contents of the table:. As you can see from the results, MySQL put values in the two columns we gave it, and set the other columns to their default values i.

We can change those values later. We have information on birds in the rookery database. The following adds four people to our table of members of the site:.

This enters information for four humans. We could do more, but this is enough for now to better understand tables and their structure. Here you can see those default settings. Notice that we did not set a default value for any of the fields except the first one when we said to use an automatically incremented number , so it set each column to a default of NULL.

The server did the same for three other columns. This is where that comes into play. Instead, the list of columns is followed by a list of keys or indexes used in the table. It then shows a unique key. Notice that the last line shows a few other settings after the closing parentheses for the set of columns.

First is the type of table used, or rather the type of storage engine used for this table. The default for your server may be different. Data is stored and handled in different ways by different storage engines.

There are advantages and disadvantages to each. These come from the default values when the database was created, or rather they came indirectly from there. You can set a different character and collation, and you can even set a different character set and collation for an individual column. Let me give you an example where setting explicit values for the character set and collation might be useful.

Suppose you have a typical database for a bird-watcher group located in England with most of its common names written in English. Suppose further that the site attracts bird-watchers from other countries in Europe, so you might want to include common bird names in other languages.

For that table, you would use a different character set and collation, because the Turkish alphabet contains both Latin and other letters. For the character set, you would use latin5 , which has both Latin and other letters. Mostly you would use it to see the assumptions that the server made when it created a table, based on the default settings during installation.

This will hold information about bird families, which are groupings of birds. The new table will save us from having to enter the name and other information related to each family of birds for each bird in the birds table:. The first is the most interesting for our purposes here. Instead, the connection will be made only when we execute an SQL statement, a query referencing both tables. For instance, we would do this when we want a list of birds along with their corresponding family names, or maybe when we want to get a list of birds for a particular family.

Now we can put all the information we want about a family of birds in one row. The third column is basically for the common names of families e. But people often associate several common names to a family of birds, as well as vague names for the types of birds contained in the family.

This is a grouping of families of birds. Enter the following SQL statement:. It might seem simpler to use distinct names for these columns in each of these tables e. However, we can resolve that ambiguity easily when necessary.

In the previous SQL statement, notice that we have a column for an image to represent the order of birds. The most common type of database which people in their homes use is a relational database. Most people now know that a database management system is used to create, maintain and organize information.

When first creating a database, you would create the database file first using a program like Access. Access has many different types of objects to be created. After successfully creating the database file, you create the database objects you want the database to contain. Once you open up Access to create your document, there will be a few different options to choose from regarding the type of database you will be creating.

A database can include a field, column, row or a table. You will be able to choose from a new blank database file, creating a database file from a template, or opening an existing database file. If you choose the first option, a blank table will open and you will be able to edit it from there. Creating new data, can be very neat and is like creating new documents on a word application, giving you the opportunity to make new projects. Information can include different types of phone numbers, addresses, notes, and reasons why you have the information saved.



0コメント

  • 1000 / 1000