CST 363 Week 4
Briefly summarize 5 things what you have learned in the course so far.
1. Constraints - Constraints are rules that apply to table columns to ensure the appropriate data is received/ An example of this would be NOT NULL or UNIQUE. NOT NULL ensures the value is not empty and UNIQUE ensures values are not duplicated.
2. Primary Keys - A primary key uniquely identifies each row in a table. They must be unique and they cannot be null. A primary key can consists of most data types and if the data type is an integer it can be auto-incremented with each new entry into a table. Primary Keys can also consist of more than one column as long as each combination of values is unique.
3. Foreign Keys - Foreign keys are a little different then Primary Keys. A foreign key creates a link between two tables by referencing another tables primary key.
4. Joining Tables - A JOIN statements combines tables based on a column they have in common. Most often this is between a primary key and foreign key, but it can be between any columns as long as they have common values. Their are multiple different types of JOIN. INNER JOIN which joins tables together and ignores NULL values, so if there is not a match the row is not included. LEFT JOIN which joins a all values in the left table regardless of if it is NULL with non NULL matches in the right table. RIGHT JOIN which is similar to the LEFT JOIN except all values from the right table are included. There are more JOIN statements but those 3 make up the bulk of them.
5. Null Values - A NULL value is treated very differently than an other programming languages. A NULL value represents missing or unknown data. It is not equal to zero or an empty string, and queries must use IS NULL or IS NOT NULL to check for them.
List at least 3 questions you still have about databases.
1. Is there a way to list all foreign or primary keys in a database, or can this only be done on individual tables?
2. Databases become more complex the more detailed they have to be, while it is possible to have a lot of foreign keys, is this realistically a good idea?
3. How can the different indexing strategies optimize the performance of the database.

Comments
Post a Comment