
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























What is a table? Answer- A table is a persistent representation of a logical relation that is a relation whose contents can be saved for permanent use. What are the characteristics of a relational table? Answer- The characteristics of a relational table are that a table is perceived as a two-dimensional structure composed of rows and columns, each row (tuple) represents a single entity occurrence within the set, each column represents an attribute, each column has a distinct name, each intersection of a row and column represents a single data value, all values in a column must be of the same data format, the order of the rows and columns don't matter to the DBMS, and each table must have an attribute (or combination of attributes) that uniquely identifies each row (tuple). What is a tuple? Answer- A tuple is a row that represents a single entity occurrence within a set. What are records? Answer- A record is the same as a tuple (row). What is a field? Answer- A field is a column. What is a key? Answer- A key consists of one or more attributes that determine other attributes. For example, a social security number identifies all of the other attributes related to that person. What is determination? Answer- Determination is the state in which knowing the value of one attribute allows you to determine the value of another attribute. For example, if you know a key, you can find other information. What is functional dependence? Answer- Functional dependence is when knowing the value of one or more attributes lets you know the value of the other attributes. For example, knowing the first name and the social security number would let you find the person's last name. What is full functional dependence? Answer- Full functional dependence is when knowing the value of one or more attributes lets you know the value of other attributes and the value of the known attributes
are NEEDED to find the other attributes. For example, a social security number lets you find the first and last name of someone. This is full functional dependence. If it was a social security number and a first name this would just be functional dependence because the first name is not required to look up the last name. All you need is the SSN. What is a determinant? Answer- A determinant is an attribute whose value determines the value of other attributes. For example, a social security number could be the determinant for your last name. What is a dependent? Answer- A dependent is an attribute whose value is determined by another attribute. For example, you last name could be a dependent of your social security number. What is a composite key? Answer- A composite key is a key that is composed of one or more attribute. For example, the key of your last name and you social security number could be used to determine your first name. This would be a composite key because you are using your last name and your SSN in the key. What is a superkey? Answer- A superkey is a key that can uniquely identify any row in a table. Some examples of this would be your social security number identifying a row corresponding to your information, but a superkey isn't limited to full functional dependence. Your SSN and your last name used as a key would still be a superkey. What is a candidate key? Answer- A candidate key is a minimal super key. This is to say it has no extra attributes. If you only need a social security number to identify the row related to a person than the candidate key is the SSN. A key consisting of an SSN and the last name in this case would not be a candidate key. What is entity integrity? Answer- Entity integrity is the condition in which each row (entity instance or tuple) in the table has it's own unique identity. This requires that all values in the primary key be unique and that the primary key cannot be null. What is a null? Answer- A null is the absence of a data value. A null should be avoided whenever possible. In fact, you can set a rule that prevents an attribute from being null. A null can create an issue when a function like average is used.
What is the property of closure? Answer- Closure is a property that permits the use of relational operators on existing relations to create new relations. What is a unary operator? Answer- A unary operator in regards to SQL is an operator that works on only one table. What is the SELECT (sometimes referred to as RESTRICT) operator used for? Answer- The SELECT (or RESTRICT) operator is used to select certain rows (aka tuples). It yields values for all rows that satisfy a given condition. For example a SELECT statement that looks for students with a gpa below 2. 0 could be used to produce a table with all rows that contain a gpa lower than 2.0. Formally, SELECT is denoted by a lower case sigma symbol. This is a unary operator that is it only accepts one table as input. What is the PROJECT operator used for? Answer- The PROJECT operator is a unary operator that will return only the attributes requested that is to say it yields columns. It does not limit the rows returned so it will return all rows within the requested columns. Formally it is denoted by the Greek letter pi. What is the UNION operator? Answer- The UNION operator combines all rows from two tables excluding duplicate rows. To be used in the UNION the two tables must contain the same attributes. Union is denoted by a symbol that looks like an uppercase U. What does it mean to be union-compatible? Answer- Union-compatible means that two or more tables contain the same number of columns of the same type. What is an INTERSECTION operator? Answer- An INTERSECTION operator is an operator that yields only rows that are in both tables. This operator requires that the tables be union-compatible. The symbol for this operation is similar to an upside down U. What is the DIFFERENCE operator? Answer- The DIFFERENCE operator is an operator that yields all the rows in one table that are not found in another table. It is seen as subtraction and it denoted by the minus sign -. It's important to note that given tables A and B the DIFFERENCE between A and B is not the same as the DIFFERENCE between B and A. Oder matters. What is the PRODUCT operator? Answer- The PRODUCT operator is an operator the yields the Cartesian product of two tables that is it yields all possible pairs of rows of the two tables. So, if one table has 3
rows and another table has 6 rows the PRODUCT of these two tables will result in a table containing 3 x 6 rows which equals 18 rows. It is represented by the multiplication symbol. What is the JOIN operator? Answer- The JOIN operator allows information from two tables to be intelligently combined into one table. It is the real power behind relational databases and allows for the use of independent tables linked by common attributes. What is a natural join? Answer- A natural join links tables by selecting only rows with common values in their common attributes. It is the result of a three stage process. First, it takes the PRODUCT of two tables thereby yielding all possible pairs of rows. Then it takes the SELECT that produces a table that contains rows such that the value of a certain attribute that are equal. Finally, it performs the PROJECT operator to ensure that there are no duplicate columns. An example of this would be if you had two tables contain student ID numbers that you wanted joined. It would first perform a Product producing a large table with all common rows. Then it would SELECT the rows in which the value of the student ids that occur in the same row are equal. Then it uses the PROJECT to eliminate the duplicate columns which in this case at the very least would get rid of one of the student id columns. What is an equijoin? Answer- Equijoin is a join operation that is performed in two steps. The first step takes the PRODUCT of two tables yielding all possible pairs of rows. Then it SELECTS rows that such that the values of a joined attribute are equal. In fact, this result is the second step of the natural join operation. This means that duplicate columns are not removed so you see the two values that are equal in the same row. What is a thetajoin? Answer- A thetajoin is any join operator that uses an ineqality comparison for the join attribute. So, it would make use of less than, greater than, less than or equal to, and greater than or equal to operators in the join statement. It works using the same two steps as the equijoin. What is an inner join? Answer- An inner join produces a table that has matched records. Natural joins and equijoins are good examples of this. What is an outer join? Answer- An outer join is a join where the matched pairs would be retained, and any unmatched values in the other table would be left null.
the school ID attribute that identifies different schools in the state. You want to avoid this as much as possible and the system catalog can help you achieve this goal. What are synonyms in the context of database design? Answer- Synonyms are words that sound differently but represent the same thing. In the context of database design, this could be something like using STU_ID for student id in one table and then using S_ID for the student id attribute name of another table. You want to avoid this as much as possible. What is the 1 :M relationship? Answer- This is the one to many relationship. It is the ideal situation for database design. A good example to illustrate this is the example of a COURSE table in a college. A single course might generate many classes, but each CLASS can only be related to one COURSE. What is the 1 :1 relationship? Answer- This is the one to one relationship. For example, one DEPARTMENT can only have one chair which is a PROFESSOR and one PROFESSOR can only chair one DEPARTMENT. What is the M:N relationship? Answer- This is a many to many relationship. It is not allowed in relational database design. In fact, if this relationship exists, you will need to turn it into a 1 :M relationship through the use of another entity that has a 1:M relationship with the entities that have the M:N relationship. What is a composite entity? Answer- A composite entity (also known as a bridge entity or an associate entity) is an entity that is used to link tables that were originally in a M:N relationship. It is required for this table to at least contain the foreign keys from both tables that were in a M:N relationship. When defining a composite table's primary key, a database designer can either create a new primary key or he can create a composite key containing the foreign keys of the other two tables. What is modality? Answer- Modality is the minimum number of times an instance of an entity can be associated with an instance in a related entity. What is cardinality? Answer- Cardinality is the maximum number of times an instance of an entity can be associated with an instance in a related entity. What is an index? Answer- An index is an orderly arrangement used to logically access rows in a table. This makes retrieval much faster. An index is composed of an index key and several pointers.
What is an index key? Answer- An index key is the thing that lets you quickly find information. For example, if you index information on paintings and you want to find information about the paintings of a specific painter, you could look up the index key of the painter and follow the pointers listed in the index to quickly access data on those paintings. What is a unique index? Answer- A unique index is an index where each index key can only have one pointer associated with it. The CUSTOMER table's primary key is CUS_CODE. The CUSTOMER primary key column has no null entries, and all entries are unique. Why type of integrity is this? Answer- Entity integrity. What is the entity relationship diagram? Answer- The entity relationship diagram represents the conceptual database as viewed by the end user. It depicts a database's main components: entities, attributes, and relationships. In the ERM (entity relationship model) what does an entity represent? Answer- In ERM, an entity represents and entity set which corresponds to a table not a row. What is a table row referred to as in the entity relationship model? Answer- A table row is referred to as an entity occurrence or an entity instance in an entity relationship model. In the crow's foot model how are entities represented? Answer- Entities are represented by a rectangle in the crow's foot model. At the top of the rectangle there is a table name in a smaller inner rectangle and then below that rectangle are the attribute names listed in another rectangle. What is a required attribute? Answer- A required attribute is an attribute that must have a value. These attributes are represented in boldface in crow's foot notation. What is an optional attribute? Answer- An optional attribute is an attribute that doesn't have to have a value and can therefore be left empty.
What are participants? Answer- Participants are entities that participate in a relationship. The relationship name will always be an active or passive verb. For example, a STUDENT takes a CLASS. The relationship is takes and the two participants are STUDENT and CLASS. This always works in both directions. For instance, a STUDENT takes a CLASS and a CLASS is taken by a STUDENT. What is connectivity? Answer- Connectivity is the classification of the relationship between entities. For example, 1 :1, 1 :M, and M:N. What is existence-dependent? Answer- An entity is said to be existence-dependent when it cannot exist on its own. In more plain terms, an entity is existence-dependent if it is required to have a foreign key. What is existence-independent? Answer- Existence-independent entities can exist on their own. This is to say, they don't need foreign keys or other entities to exist. This can also be referred to as a strong entity or a regular entity. For example, if you look at the two entities PARTS and VENDOR. The VENDOR supplies PARTS could be a true statement regarding their relationship, but if VENDOR doesn't supply all the parts then PARTS is existence-independent. What is a weak relationship? Answer- A weak relationship, also known as a non-identifying relationship, if the primary key of the related entity does not contain a primary key component of the parent entity. Crow's foot notation depicts a weak relationship between entities by placing a dashed line between those entities. What is a strong (identifying) relationship? Answer- A strong (identifying) relationship is a relationship where the primary key of the parent entity makes up part of the primary key of a related entity. For example, COURSE has the primary key CRS_CODE and CLASS has the primary key, CRS_CODE and CL_SECTION. Note that this primary key is a composite key. Crow's foot depicts a strong relationship with a solid line between entities. What is a weak entity? Answer- A weak entity is one that is existence-dependent and has the primary key partially or totally derived from the parent entity (aka strong relationship).
What is optional participation? Answer- Optional participation means that a relationship between two entities isn't required to take place. For example, CLASS generates COURSE, but it doesn't have to. Some semesters a class won't be offered. What is mandatory participation? Answer- Mandatory participation means that one entity occurrence requires another entity occurrence. If no symbol exits to show it is optional then it is assumed to be mandatory by default in entity relationship modeling. What is relationship degree? Answer- The relationship degree indicates the number of entities or participants associated with a relationship. What is a unary relationship? Answer- A unary (aka recursive) relationship is when an association exists with a single entity. For example, an EMPLOYEE manages an EMPLOYEE. What is a binary relationship? Answer- A binary relationship exists when two entities are associated. For example, a PROFESSOR teaches a CLASS. What is a ternary relationship? Answer- A ternary relationship exists when three entities are associated. For example, a TEACHER grades a EXAM and a TEACHER grades a STUDENT. In practice this relationship would look something like TEACHER grades EXAM, STUDENT receives EXAM, and EXAM appears in REPORT CARD. What is a recursive relationship? Answer- A recursive relationship is one in which a relationship can exist between entities of the same set. For example, EMPLOYEE manages, marries, or is related to EMPLOYEE. All three of those relationships would be recursive. What is SQL. Answer- SQL is both a data definition language and a data manipulation language. What is a data definition language? Answer- A data definition language is a standard for commands that define structures in a database. DDL statements create, modify, and remove database objects such as tables, indexes, and users. They can also be used to define data access rights.
What does the command CREATE VIEW do? Answer- CREATE VIEW is a SQL DDL command that creates a dynamic subset of rows and columns from one or more tables. What does the command ALTER TABLE do? Answer- ALTER TABLE is a SQL DDL command that modifies a tables definition that is it adds, modifies, or deletes attributes or constraints. What does the command CREATE TABLE AS do? Answer- CREATE TABLE AS is a SQL DDL command that creates a new table based on a query in the user's database schema. What does the command DROP TABLE do? Answer- DROP TABLE is a SQL DDL command that permanently deletes a table and the data it contains. What does the command DROP INDEX do? Answer- DROP INDEX is a SQL DDL command that permanently deletes an index. What does the command DROP VIEW do? Answer- DROP VIEW is a SQL DDL command that permanently deletes a view. What does the command INSERT do? Answer- INSERT is a SQL DML command that inserts a row or rows into a table. What does the command SELECT do? Answer- SELECT is a SQL DML command that selects attributes from rows in one or more tables or views. For example, if you only want the rows to show the attributes STU_ID, STU_GPA, and STU_LNAME, you would use a SELECT statement. What does the command WHERE do? Answer- WHERE is a SQL DML command that restricts the selection of rows based on a conditional expression. For example, if you want to produce a table of student ID's of students who have a gpa of less than 2 .0 you could write the statement: SELECT STU_ID FROM STUDENT WHERE STU_GPA < 2 .0;
What does the command GROUP BY do? Answer- GROUP BY is a SQL DML command that groups selected rows based on one or more attributes. What does the command HAVING do? Answer- HAVING is a SQL DML command that restricts the selection of grouped rows based on a condition. What does the command ORDER BY do? Answer- ORDER BY is a SQL DML command that orders the selected rows based on one or more attributes. What does the command UPDATE do? Answer- UPDATE is a SQL DML command that modifies an attributes values in one or more table's rows. What does the command DELETE do? Answer- DELETE is a SQL DML command that deletes one or more rows from a table. What does the command COMMIT do? Answer- COMMIT is a SQL DML command that permanently saves changes to data. What does the command ROLLBACK do? Answer- ROLLBACK is a SQL DML command that restores data to its original values. What is authentication? Answer- Authentication is the process the DBMS uses to verify that only registered users access the database. What is a schema? Answer- A schema is a logical group of database objects that are related to each other. For example, you might want to group database objects that people in human resources need into one schema. How is datatype determined? Answer- Datatype is determined by the nature of the data and expected use of the data. For example, the nature of a phone number is that it contains numbers. You might think that means you should set the data type to a numeric data type, but you don't really need to perform numerical operations on phone numbers. You aren't adding, subtracting, etc. to obtain meaningful results so it might make more sense to save them as characters. Then you could put limits on which
For example: UPDATE STUDENT SET STU_GPA = 3. WHERE STU_UNI = 'WGU'; This line of code would set the gpa of all students in the table who went to school at WGU to 3.0. What is the condition for using the ROLLBACK command? Answer- The ROLLBACK command can only be used when you have yet to COMMIT the code. It undoes every change made since the last time the code was committed. How do you use the DELETE command? Answer- DELETE FROM tablename [WHERE conditionlist ]; For example, DELETE FROM STUDENT WHERE STU_GPA < 2 .0; This deletes the records of all students who have less than a 2 .0 gpa from the table. What does the following code do? DELETE FROM STUDENT; Answer- It deletes all of the rows in the table, STUDENT. What is a subquery (also known as an inner query or a nested query)? Answer- A subquery is a query that is nested or embedded into another query. How do you insert multiple rows into a table by using rows in another table? Answer- INSERT INTO tablename SELECT columnlist FROM tablename2;
This is a subquery that first executes the SELECT statement on tablename2 and uses that as the input for the INSERT statement on tablename. What is an alias? Answer- An alias is an alternate name given to a column or table in a SQL statement. For example, SELECT P_DESCRIPT, P_QOH, P_PRICE, P_QOH * P_PRICE AS TOTVALUE FROM PRODUCT; This saves the derived value of P_QOH * P_PRICE in the column with the name TOTVALUE. SELECT * FROM PRODUCT WHERE P_PRICE BETWEEN 50. 0 0 AND 1 0 0.0 0 ; Answer- Creates a table using all columns from the PRODUCT table where the value of P_PRICE is greater than or equal to 50. 00 or less than or equal to 10 0. 0 0. SELECT P_CODE, P_DESCRIPT, V_CODE FROM PRODUCT WHERE V_CODE IS NULL; Answer- Creates a table with the attributes (columns) P_CODE, P_DESCRIPT, and V_CODE from the PRODUCT table when the V_CODE has a NULL value. SELECT P_CODE, P_DESCRIPT, V_CODE FROM PRODUCT WHERE V_CODE = NULL; Answer- ERROR. NULL is not a value so you can't use a comparison operator on it. SELECT V_NAME, V_CONTACT, V_AREACODE, V_PHONE FROM VENDOR
DROP COLUMN V_ORDER; Answer- Deletes the column V_ORDER. What is the difference between INSERT and UPDATE? Answer- INSERT adds new rows to tables while UPDATE changes values in rows that already exist. SELECT DISTINCT V_CODE FROM PRODUCT; Answer- Lists only rows with a V_CODE that doesn't show up in the table again. What is the difference between an inner join and an outer join? Answer- An inner join is a traditional join operation where only rows that meet a given criterion are selected. The join criterion could be an equality condition (such as in an equijoin aka a natural join) or an inequality condition such as in a thetajoin. An outer join is a join that returns not only the matching rows, but it also returns the unmatched rows for one or both of the tables being joined. What is a cross join? Answer- A cross join is a join that returns the Cartesian product of two sets or tables. The Cartesian product of two tables yields all possible pairs of rows of the two tables. So, if one table has 3 rows and another table has 6 rows the PRODUCT of these two tables will result in a table containing 3 x 6 rows which equals 18 rows. SELECT * FROM T1, T2 Answer- Cross join. It returns the Cartesian product of T1 and T 2. This is the old way of writing a cross join. SELECT * FROM T1 CROSS JOIN T2 Answer- Different way to write the syntax for a cross join. It returns the Cartesian product of T1 and T 2. SELECT * FROM T1, T WHERE T1.C1=T2.C1 Answer- This is the old style of an inner join. This is a natural join as it only joins rows where matching values are selected.
FROM T1 NATURAL JOIN T2 Answer- Modern form of the natural join. It returns the rows with matching values SELECT * FROM T1 JOIN T2 USING (C1) Answer- Inner join. Returns only the rows with matching values in the columns indicated in the USING clause. SELECT * FROM T1 JOIN T2 ON T1.C 1 =T2.C1 Answer- Returns only the rows that meet the join condition indicated in the ON clause. Inner join. SELECT * FROM T1 LEFT OUTER JOIN T2 ON T1.C 1 =T2.C1 Answer- Left outer join that returns rows with matching values and includes all rows from the left table (T1) with unmatched values. SELECT * FROM T1 RIGHT OUTER JOIN T2 ON T1.C1=T 2 .C1 Answer- Returns rows with matching values and includes all rows from the right table (T 2 ) with unmatched values. This is a right outer join. SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C 1 =T 2 .C1 Answer- Full outer join. Returns rows with matching values and includes all rows from both tables (T1 and T 2 ) with unmatched values. SELECT column-list FROM table1 CROSS JOIN table 2 Answer- This is the general syntax for a cross join. SELECT * FROM INVOICE CROSS JOIN LINE; Answer- Cross join. If there are 8 rows in Invoice and 18 rows in Line then you will end up with 8 times 18 or 1 4 4 rows. SELECT INVOICE.INV_NUMBER, CUS_CODE, INV_DATE, P_CODE