In your own words define the following database terms and gi
In your own words, define the following database terms and give an example of each:
Table
Record
Field
Primary Key
Foreign Key
Solution
 Table -
 A table is a set of data element using the columns and rows.
 which store the data.which has a number of columns and rows.
 e.g - A table of student which contains student data.
---------+---------------+------+-----+---------+-------+
 | Field | Type | Null | Key | Default | Extra |
 +---------+---------------+------+-----+---------+-------+
 | ID | int(11) | NO | PRI | | |
 | NAME | varchar(20) | NO | | | |
 | AGE | int(11) | NO | | | |
 | ADDRESS | char(25) | YES | | NULL | |
 | SALARY | decimal(18,2) | YES | | NULL | |
 +---------+---------------+------+-----+---------+-------+
Record -
A single entry in a table is called a record or row.
 A record in a table represent set of related data.
e.g. example of single record.
 1   Adam   34   13000.
 Field -
A table consist of several records i.e row ,each record can be brocken
 into several smaller entities known as field.
e.g a table consist of four field, ID,NAME,AGE,SALARY.
 Primary Key -
Is the a column inside a table which is used to identify each row or record in a table.
e.g. -
CREATE TABLE Persons
 (
 P_Id int NOT NULL,
 LastName varchar(255) NOT NULL,
 FirstName varchar(255),
 Address varchar(255),
 City varchar(255),
 PRIMARY KEY (P_Id)
 )
 P_Id is the primary key inside a table Person.
 Foreign Key -
 A Foreign key is the key inside the table which points to primary key of another table.
e.g
 -
CREATE TABLE customer1(
 cust_code char(6) NOT NULL PRIMARY KEY,
 cust_name char(25),
 cust_city char(25),
 agent_code char(6),
 FOREIGN KEY(agent_code)
 REFERENCES agents (agent_code)
 ) ;
 where agent_code is the foreign key.


