Section 3 - Creating Databases and Tables Flashcards
Can you have more than one database on the same database server? (YES / NO)
YES
What is the naming convention for when and when not to use CAPITAL letters?
- Use UPPERCASE for SQL commands
- Use lowercase for custom names
For example, “CREATE DATABASE augiesdatabase”
What is the command for deleting a database?
DROP DATABASE ;
Write a command for deleting a database named useless_database.
DROP DATABASE useless_database;
Broadly-speaking, what is a database composed of? (At least, a what is a relational database composed of?)
A bunch of tables.
These tables contain data.
What is a table?
A table holds the data.
Specifically, a table is a collection of related data held in a structured format within a database.
A database is structured via ________s and ________s.
A database is structured via COLUMNs and ROWs.
What is a column in a database?
Think of a column like a “Header” or category.
For example, first_name, age, last_name, major, relatives, hobbies might all be columns.
What is a ROW in a table composed of?
A ROW contains the actual data in the tables.
For example, if we have a column named, “first_name”, the corresponding row might contain data like, “Adam”, “Adrian”, “Penelope”, “Vivian”, “Gina”, “Cooper”, etc.
Most Databases are Composed of Lots and Lots of Tables: TRUE or FALSE
TRUE
What is a Data Type?
Give two examples.
A data type is a structured data format by which we can input/aggregate similar data.
For example, VARCHAR is a text data type, whereas INT (integer) is a number data type.
If we had a column of people’s ages, we would definitely want this to be an INT data type, because age is never (or very rarely should be) a text field.
Give one example where data type could be helpful.
You have an age column for keeping track of your employees health insurance.
Keeping the column as an INT is helpful. If you could type any type of text, it’d be much more difficult to read and manipulate the data.
For example, people could list their age as “Twenty-seven”, “Twenty seven”, “27”, “twenty 7” or whatever else if you did not restrict your data type to INT.
As you can see, that would get confusing real fast!
What is a STRING data type?
STRING data types are data types involving letters/text. (As opposed to Numeric data types, which involve numbers.)
What is a NUMERIC data type?
NUMERIC data types involve numbers. (As opposed to text / letters.)
WHAT IS a DATE data type?
A DATE data type involves various DATE/Calendar/day of year formats. This is different and more specific than the numerica