Quiz 1 Flashcards

1
Q

What are the 4 ways to communicate with a database management system?

A
  • DDL – data definition language
    E.g. Create, drop, alter, truncate, …
  • DQL – data query language
    E.g. Select
  • DML – data manipulation language
    E.g. Insert, update, delete
  • DCL – data control language
    E.g. Grant, revoke
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a paradigm in relation to database management systems?

A

In the context of database management systems (DBMS), a paradigm typically refers to a particular approach or model for structuring, storing, and manipulating data. The choice of paradigm will influence how data is represented, accessed, and modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the Key-Value Paradigm

A
  • EXAMPLES: REDIS, ORACLE NOSQL

A simple paradigm where every data item is stored as a key-value pair. This model is ideal for scenarios where quick access to data is crucial, and the relationship between data points is not significant. Redis and Riak are examples of key-value databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the Wide-Column Paradigm

A

This is is a database model designed for large-scale, distributed data storage. Instead of traditional fixed columns, it uses dynamic columns grouped into column families. Each row has a unique key and can have different columns. This model is optimized for querying vast amounts of distributed data. Popular databases using this paradigm include Apache Cassandra and Google Bigtable. They’re great for handling massive datasets and offer flexibility in data organization.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the Document-Based Paradigm

A

This paradigm is prevalent in some NoSQL databases. Data is stored in documents, which can be in formats like JSON or XML. Each document can contain different fields, offering flexibility and scalability. MongoDB is a well-known example of a document-oriented database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Object Paradigm

A

This paradigm is built around the concept of objects, which combine both data and methods to operate on that data. Object-oriented databases aim to preserve the encapsulation, inheritance, and polymorphism principles of object-oriented programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the Graph-Based Paradigm

A

The Graph-Based paradigm is a database model that represents data as nodes (entities) and edges (relationships). It’s especially useful for understanding and analyzing complex relationships and interconnections. Popular databases like Neo4j use this paradigm. It’s ideal for scenarios where relationships between data points are central.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the Relational Paradigm

A

his is the most widely known and used paradigm. Based on relational algebra and set theory, it represents data in tables (or relations) with rows and columns. The SQL (Structured Query Language) is used to query and manipulate the data. Databases that adopt this paradigm are termed Relational Database Management Systems (RDBMS), and examples include MySQL, PostgreSQL, Microsoft SQL Server, and Oracle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the different cardinalities in eer

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is inheritance

A

Entity Inheritance (Is-A relationship): This is where you have a general entity (sometimes called a parent or superclass) and a specialized entity (which can be thought of as a child or subclass). For example, consider an entity named “Vehicle” and another entity named “Car”. A “Car” is a type of “Vehicle”, so in this case, “Car” is a child of “Vehicle”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are Hierachies

A

ER Hierarchies: In some diagrams, you might have a hierarchy of entities or relationships. The entities or relationships that derive or extend from a primary entity or relationship can be thought of as “children”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a disjoint constraint?

A

When sub-classes (or sub-types) of a specialization/generalization hierarchy are disjoint, it means that an instance (an individual object or entity) of the superclass (or parent entity) can belong to one, and only one, subclass. In other words, the subclasses don’t share any common instances. In many EER diagrams, this constraint is denoted by the letter “d” or by using a disjoint symbol.

For example, let’s say you have a superclass called “Vehicle” with two subclasses: “Car” and “Boat”. If the hierarchy is disjoint, then a specific vehicle can’t be both a car and a boat.

18
Q

What is an overlap constraint?

A

When sub-classes (or sub-types) of a specialization/generalization hierarchy can overlap, it means that an instance of the superclass can belong to more than one subclass. This means there can be shared instances between subclasses. In many EER diagrams, this constraint is denoted by the letter “o” or by using an overlapping symbol.

Taking the above example, if the hierarchy is overlapping, then it’s possible for a specific vehicle to be classified both as a “Car” and a “Boat” (though this might not make logical sense in this particular example).

19
Q

What is a Strong Entity?

A

In the context of Entity-Relationship (ER) and Enhanced Entity-Relationship (EER) diagrams, a strong entity is an entity that exists independently of any other entities in the diagram. In other words, it doesn’t rely on another entity to provide its primary key.

20
Q

What is an associative entity?

A

An associative entity in EER diagrams represents a many-to-many relationship between two entities, allowing for the capture of additional information about that relationship. It typically:

-Links Many-to-Many Relationships: For example, between “Students” and “Courses”.
-Holds Additional Attributes: Like “Date of Enrollment” in the relationship between students and courses.
-Uses a Composite Primary Key: Derived from the primary keys of the entities it connects, such as combining Student ID and Course ID.

In essence, it bridges two entities while capturing more data about their relationship.

21
Q

What is a multi-valued attribute?

A

In an EER (Enhanced Entity-Relationship) diagram, a multi-valued attribute is an attribute that can have multiple values for a single entity instance.

Key Points:

-Representation: It’s usually represented by a double oval connected to the entity or relationship by a straight line.

-Example: Consider an entity “Person” and an attribute “Phone Numbers”. If a person can have multiple phone numbers, then “Phone Numbers” is a multi-valued attribute.

-Difference from Other Attributes: Standard attributes hold a single value (like a person’s first name). In contrast, multi-valued attributes can hold a set of values for each entity instance.

22
Q

What is the CAP theorem?

23
Q

What is Normalisation in relation to DBMS

A

Normalization in database management systems aims to organize data to minimize redundancy and improve data integrity. It involves:

Purpose:

-Reduce redundant data.
-Ensure logical data storage.
-Enhance data integrity.

Normal Forms: Levels of normalization include 1NF to 5NF, with most databases aiming for 3NF. Each form has specific criteria, like ensuring atomic values in 1NF and removing partial dependencies in 2NF.

Benefits:

-Reduces data anomalies.
-Minimizes redundancy.
-Streamlines data structure.

Trade-offs:

-Can increase table count, complicating queries.
-Might affect performance due to table joins.

Normalization is a balance between reducing redundancy and optimizing performance. Sometimes, databases are denormalized for performance needs.

24
Q

What is UNF to 3NF

A

In database management systems, the process of normalization involves organizing the attributes and relations of a relational database to minimize data redundancy and dependency. Normal forms (NF) are stages or levels of normalization. Here’s a quick overview from UNF (Unnormalized Form) to 3NF:

UNF (Unnormalized Form):

Raw data as it’s initially collected.
Contains duplicate data and lacks structural organization.
1NF (First Normal Form):

Each table has a primary key: uniquely identifying each record.
Attributes contain only atomic (indivisible) values, ensuring there are no repeating groups or arrays.
2NF (Second Normal Form):

All requirements of 1NF are met.
Every non-key attribute is fully functionally dependent on the primary key, which means there are no partial dependencies of any column on the primary key. This typically involves separating tables.
3NF (Third Normal Form):

All requirements of 2NF are met.
No transitive dependencies of non-key attributes on the primary key. In other words, non-key attributes must be functionally dependent only on the primary key.

25
What is BCNF, 4NF, or 5NF
BCNF (Boyce-Codd Normal Form): A stricter version of 3NF. For any non-trivial functional dependency A→ Y, A must be a superkey. 4NF (Fourth Normal Form): Removes multi-valued dependencies. A table is in 4NF if it's in BCNF and has no multi-valued dependencies. 5NF (Fifth Normal Form or PJNF): Ensures data can be recomposed from sub-tables without loss or redundancy. A table is in 5NF if it's in 4NF and, for every non-trivial join dependency, the intersection of each pair is a superkey.
26
What is the syntax to create a table in SQL?
CREATE TABLE table_name ( column1 datatype1, column2 datatype2, ... columnN datatypeN );
27
Can you give me an example of creating a table for students in SQL. There needs to be a student id (PK), first name, last name and age
CREATE TABLE Students ( StudentID INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50), Age INT );
28
What is the syntax to insert values into a table in SQL?
INSERT INTO table_name (column1, column2, ... columnN) VALUES (value1, value2, ... valueN);
29
What is an example of the syntax to insert values into a table in SQL for Students?
INSERT INTO Students (StudentID, FirstName, LastName, Age) VALUES (1, 'John', 'Doe', 20);
30
What is the syntax to create a comment in SQL
It is "--"
31
What is the syntax to use a database in SQL
if the database is called "Database1" then the syntax is "use Database1"
32
If a value wants to be added with an int and the int needs to be a positive number what to you add to the line
UNSIGNED
33
If a value wants to be added with an int and the int needs to not be NULL what to you add to the line
NOT NULL
34
How to see information from a DBMS using SQL
Type the following: SELECT 'information' From databasename;
35
How to count the number of enrolmentIDS from denormalisation table
36
How to show all the information from the denormalisation table
37
Using the following information use SQL code to see how many enrolments does each student have
38
Using the following information use SQL code to see how many enrolments does each student have. Sort them by first name in descending order
39
Using the following information use SQL code to show me all the enrolments with a person who has the letter a in their name
40
Using the following information use SQL code to show me all the people who have 4 or more enrollments.
41