A database schema is an abstraction used to represent the storage of data in a database. It not only describes the organization of data but also represents the relationship between various tables in a database.
There are two types of database schemas.
Logical database schema: This is best described as a design blueprint of how the data is organized and used by humans (not machines) to meet business requirements.
Physical database schema: This represents how data is actually stored physically on disk storage.
The difference between these two schemas is summarized in the table below.
Primary key: It is used to uniquely identify a record in the table.
Foreign key: It is an attribute that is used as a primary key in another table.
The following code snippet defines the schema of a table mapdata in MySQL.
CREATE TABLE mapdata ( id integer NOT NULL AUTO_INCREMENT, mapid integer NOT NULL, x integer NOT NULL, y integer NOT NULL, z integer NOT NULL, value varchar(1), UNIQUE KEY(id))
View all Courses