For example, a customers table might store one customer per row. The number of rows in the table is the number of records in it.
Row A record in a table.
Records or Rows?
You may hear users refer to database records when referring to rows. For the most part, the two terms are used interchangeably, but row is technically the correct term.
Primary Keys
Every row in a table should have some column (or set of columns) that uniquely identifies it. A table containing customers might use a customer number column for this purpose, whereas a table containing orders might use the order ID. An employee list table might use an employee ID or the employee social security number column.
This column (or set of columns) that uniquely identifies each row in a table is called a primary key. The primary key is used to refer to a specific row. Without a primary key, updating or deleting specific rows in a table becomes extremely difficult as there is no guaranteed safe way to refer to just the rows to be affected.
Always Define Primary Keys Although primary keys are not actually required, most database designers en
sure that every table they create has a primary key so that future data manipulation is possible and manageable.
Any column in a table can be established as the primary key, as long as it meets the following conditions:
• No two rows can have the same primary key value.
• Every row must have a primary key value (primary key columns may not allow NULL values).
• Values in primary key columns can never be modified or updated.
• Primary key values can never be reused. (If a row is deleted from the table, its primary key may not be assigned to any new rows in the future.)
What Is SQL?
SQL (pronounced as the letters S-Q-L or as sequel) is an abbreviation for Structured Query Language. SQL is a language designed specifically for communicating with databases.
Unlike other languages (spoken languages like English, or programming languages like Java or Visual Basic), SQL is made up of very few words. This is deliberate. SQL is designed to do one thing and do it well—provide you with a simple and efficient way to read and write data from a database.
Primary keys are usually defined on a single column within a table. But this is not required, and multiple columns may be used together as a primary key. When multiple columns are used, the rules listed above must apply to all columns that make up the primary key, and the values of all columns together must be unique (individual columns need not have unique values).