Learning About Schema and Data Types
00:00 Another important concept of MySQL is a schema that is equivalent to a database. In MySQL, in order to build a relational database, you start with creating a new database.
00:15 This means generating a schema that includes namespaces for tables, views, stored procedures, and functions. On the left pane, you see a newly-created movie_rating schema that has tables namespace.
00:35 If you expand tables, you will see a newly created
00:40 reviewers table with a predefined schema below. In this example, we check mark PK and NN boxes, meaning that the reviewers_id column represents a primary key and it is known now that is, it cannot have null values.
01:01 The primary key is of integer type with a maximal length of 11 digits, whereas first name and second name attributes are of character type with a variable length of a maximum of 100 characters.
01:18 At this point, we have completely defined the structure of the reviewers table. We have specified its attribute columns, the primary key, and the attribute data types.
01:31
This is what we refer to as a table schema. In this example, the schema has a name reviewers
. In MySQL, every table follows a well-defined schema to ensure the consistency of data stored in these tables.
01:49 Data consistency means avoidance of data entries that contradict the specified data types. For example, you cannot enter an integer value into the first_name field.
Become a Member to join the conversation.