What is Database ?
- A database is a collection of information that is organized so that it can be easily accessed, managed and updated.
- Data is organized into rows, columns and tables, and it is indexed to make it easier to find relevant information.
What is Database Management System?
- A database management system (DBMS) is system software for creating and managing databases.
- The DBMS provides users and programmers with a systematic way to create, retrieve, update and manage data.
Tables (Database)
- A database table is composed of records and fields that hold data.
- Tables are also called datasheets. Each table in a database holds data about a different, but related, subject.
![]() |
Figure 1 |
Record (Database)
- Data is stored in records.
- A record is composed of fields and contains all the data about one particular person, company, or item in a database.
- In this database, a record contains the data for one customer support incident report. Records appear as rows in the database table.
Field (Database)
A field is part of a record and contains a single piece of data for the subject of the record. In the database table illustrated in Figure 4, each record contains four fields:
Log IDA number assigned to this customer support incident for identification purposes
OperatorThe code for the customer support operator who handled this incident
ResolvedA check box to indicate whether the incident was resolved
DurationThe time in seconds the operator spent on this incident
Report (Database)
- A database report is the formatted result of database queries and contains useful data for decision-making and analysis.
- Data can be grouped or sorted and arranged in a variety of ways.
Query (Database)
- A query finds records in a database according to criteria you specify.
- Sometimes working with all the data in a large database is not practical.
- You might wish to work with just a small part or subset of the data.
- For example, you might want to find records for unresolved customer support incidents.
- A query can be used to display these records.
- You could construct the query to display only selected fields, such as Log ID and Resolved.
Primary Key
A primary key is a special relational database table column (or combination of columns) designated to uniquely identify all table records.
A primary keyโs main features are:
- It must contain a unique value for each row of data.
- It cannot contain null values.
A primary key is either an existing table column or a column that is specifically generated by the database according to a defined sequence.
Tips for Choosing Good Primary Keys
When you choose the right primary key, database lookups are speedy and reliable. Just remember:
- Keep it short. Because the primary key is used for lookups and comparisons, a short primary key means the database management system can process it more quickly than a long primary key.
- Use a number for the primary key whenever possible. SQL Server or other database management systems process number data types faster than character data types.
- Keep it simple. Don't use any special characters, embedded spaces, or a mix of upper and lower capitalization.
- Never change the primary key after you assign it.
Foreign Key
- A foreign key is a column or columns of data in one table that connects to the primary key data in the original table.
- To ensure the links between foreign key and primary key tables aren't broken, foreign key constraints can be created to prevent actions that would damage the links between tables
- It also prevent erroneous data from being added to the foreign key column.
- A foreign key is a column or columns of data in one table that connects to the primary key data in the original table.
- To ensure the links between foreign key and primary key tables aren't broken, foreign key constraints can be created to prevent actions that would damage the links between tables
- It also prevent erroneous data from being added to the foreign key column.
Differences between primary and foreign keys
- A primary key in the original table, or parent table, can be targeted by multiple foreign keys from other "child" tables.
- But a primary key does not necessarily have to be the target of any foreign keys. A primary key is a column or a set of columns that identify a row in a table.
- A foreign key, however, is in a table that is different from the table that the primary key must match.
References
- A primary key in the original table, or parent table, can be targeted by multiple foreign keys from other "child" tables.
- But a primary key does not necessarily have to be the target of any foreign keys. A primary key is a column or a set of columns that identify a row in a table.
- A foreign key, however, is in a table that is different from the table that the primary key must match.
References
goodjob. nice work
ReplyDeleteNice one sis! Keep it up!!
ReplyDelete