DATABASE APPIAN Notes
DATABASE APPIAN Notes
Databases are mainly used to make searching and retrieving data quick and efficient.
An entity is an abstract concept for something that you want to store information
about. This could be a thing, person, organization, place, unit, object, or item. As an
example, for a vehicle management company, possible entities include vehicle or
customer.
A row in a table is sometimes referred to as a record. While columns provide the
structure for a table, the rows contain the data.
A schema is known as a database’s “blueprint,” and describes how data is organized
within a relational database.
Constraints are rules enforced on the columns of a table. These rules help limit the
type of data that can go into a column. The purpose of constraints is to ensure the
data in a database is accurate and reliable
Correct! A primary key is a way to uniquely identify a row in a table. While the Employee ID uniquely
identifies rows in the Employee table, the Department ID uniquely identifies rows in the Department
table.
Data types are an important concept in databases. From an earlier lesson, you know that
data types are used to define what kind of value can be stored in a column. Only one kind,
or type, of value can be stored in any one column.
Play Video
String
–
There are a few different data types for strings of text. One type is CHAR. This is a fixed
length string, which means every value must contain the same number of characters.
Another type is a VARCHAR. This is a variable length string. You have to set an upper limit on
how many characters the value can be, so if you have a VARCHAR(100), the values in that
column can be any length up to 100. There is also TEXT, which is useful for storing long-form
text strings or when you don’t want to specify a specific length.
Numeric
–
Numeric types can be exact values or approximate values. Integers and decimals are exact
values, while floating point numbers are approximate values. The difference between exact
and approximate values is precision. A DECIMAL is more precise than a FLOAT or DOUBLE.
Numerics can also have an extra option: UNSIGNED. If a numeric data type is unsigned,
MySQL does not allow negative values. For example, in MySQL, TINYINT is an integer whose
range is from -128 to 127. If the TINYINT is UNSIGNED, the range is now 0 to 255.
Date and Time
–
Date and Time data types include either a date, a time, or both. An example is DATE. In
MYSQL, if a column is designated as DATE, all the values must be DATE and in the format
YYYY-MM-DD.
Boolean
–
In databases, a boolean data type is used when you need to store information as either true
or false. In MySQL, if you use BOOLEAN, a zero indicates false and a one is used to indicate
true.
These are the most common primitive data types. Remember that every column must have
a data type and all values in that column must conform to that data type. Different
databases may allow all of these data types, or only some of them.
The CHAR data type is used to store strings with fixed lengths, and TEXT is used to store longer strings of
text.
record[recordType!Vehicle.make]