DBMS Lab 3-4
DBMS Lab 3-4
Tables can be created using CREATE TABLE statement and it has the
following syntax.
CREATE TABLE [IF NOT EXISTS] `TableName` (`fieldname` dataType [optional parameters]);
Date / Time
DATE YYYY-MM-DD
DATETIME YYYY-MM-DD HH:MM:SS
TIMESTAMP YYYYMMDDHHMMSS
TIME HH:MM:SS
Apart from above there are some other data types in MySQL.
ENUM To store text value chosen from a list of predefined text values
This is also used for storing text values chosen from a list of predefined text
SET
have multiple values.
BOOL Synonym for TINYINT(1), used to store Boolean values
BINARY Similar to CHAR, difference is texts are stored in binary format.
VARBINARY Similar to VARCHAR, difference is texts are stored in binary format.
Table 1: members table
Executing the above script on the “myflixdb” would produce the following
results.
Suppose we want to get a list of all the movies in category 2 that were
released in 2008, we would use the script shown below is achieve that.