Babu's Study Deck Flashcards
getting a developer job
What is a RDBMS?
Database management systems that maintain data records and indices in tables. A program that allows you to Create, Read, Update, and Delete a relational database.
What are the properties of the relational tables?
- Values are atomic
- Column values are of the same kind
- Each row is unique
- The sequence of columns is insignificant
- The sequence of rows is insignificant
- Each column must have a unique name
What is normalization?
The process of organizing data to minimize redundancy. It usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.
What is de-normalization?
The process of attempting to optimize the performance of a database by adding redundant data. It is a technique to move from higher to lower normal forms of database modeling in order to speed up database access. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. It eliminates redundant data (storing the same data in more than one table) and it ensures data dependencies make sense.
How is ACID property related to database?
ACID properties help to maintain consistency in a database, before and after a transaction. The ACID properties, in totality, provide a mechanism to ensure correctness and consistency of a database in a way such that each transaction is a group of operations that acts as a single unit, produces consistent results, acts in isolation from other operations and updates that it makes are durably stored.
What is the “A” in ACID?
Atomicity the entire transaction takes place at once or doesn’t happen at all. It involves two operations (1) Abort: if a transaction aborts, changes made to database are not visible (2) Commit: if a transaction commits, changes made are visible. Atomicity is as known as the ‘All or nothing rule’.
What is the “C” in ACID?
Consistency integrity constraints must be maintained so that the database is consistent before and after the transaction. It refers to correctness of a database.
What is the “I” in ACID?
Isolation ensures that multiple transactions can occur concurrently without leading to inconsistency of database state. Transactions occur independently without interference. Transactions occur independently without interference. Changes occurring in a particular transaction will not be visible to any other transaction until that particular change in that transaction is written to memory or has been committed. This property ensures that the execution of transactions concurrently will result in a state that is equivalent to a state achieved if these were executed serially in some order.
What is the “D” in ACID?
Durability ensures that once the transaction has completed execution, the updates and modifications to the database are stored in and written to disk and they persist even if system failure occurs. These updates now become permanent and are stored in a non-volatile memory.
What are the different normalization forms?
- 1NF: Eliminate Repeating Groups
- 2NF: Eliminate Redundant Data
- 3NF: Eliminate Columns Not Dependent On Key
- BCNF: Boyce-Codd Normal Form
- 4NF: Isolate Independent Multiple Relationships
- 5NF: Isolate Semantically Related Multiple Relationships
- ONF: Optimal Normal Form
- DKNF: Domain-Key Normal Form
What is 1NF?
Eliminate repeating groups. Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.
- It should only have single (atomic) valued attributes/columns
- Values stored in a column should be of the same domain
- All columns in a table should have unique names
- The order in which data is stored does not matter
What is 2NF?
Eliminate redundant data. If an attribute depends on only part of a multi-valued key, then remove it to a separate table. For a table to be in the Second Normal Form:
- It should be in the First Normal Form
- It should not have Partial Dependency
What is 3NF?
Eliminate columns not dependent on key. If attributes do not contribute to a description of the key, then remove them to a separate table. All attributes must be directly dependent on the primary key. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database. A table is in Third Normal Form when:
- It is in Second Normal Form
- It does not have Transitive Dependency
What is BCNF?
Boyce-Codd Normal Form is a higher version of the Third Normal Form and deals with certain type of anomaly that is not handled by 3NF. If there are non-trivial dependencies between candidate key attributes, then separate them out into distinct tables. A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF.
- R must be in 3rd Normal Form
- Each functional dependency (X → Y), X should be a super key
What is 4NF?
Isolate independent multiple relationships. No table may contain two or more 1:n or n:m relationships that are not directly related.
- It is in the Boyce-Codd Normal Form
- It doesn’t have Multi-valued Dependency
What is 5NF?
Isolate semantically related multiple relationships. There may be practical constrains on information that justify separating logically related many-to-many relationships.
What is ONF?
Optimal Normal Form. A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.
What is DKNF?
Domain-key Normal Form. A model free from all modification anomalies is said to be in DKNF.
What is a stored procedure?
A named group of SQL statements that have been previously created and stored in the server database. They reduce network traffic and improve performance and can be used to help ensure the integrity of the database.
What is a trigger?
A SQL procedure that initiates an action when an event (INSERT, DELETE, or UPDATE) occurs. They are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. It cannot be called or executed. You can have nested triggers.
What are the different types of triggers?
1) DML Trigger
a) Instead of Triggers are fired in place of the triggering action such as an insert, update, or delete
b) After Triggers execute following the triggering action, such as an insert, update, or delete
2) DDL Trigger is fired against Drop Table, Create Table, Alter Table, or Login events and are always after triggers.
What is a view?
A virtual table. It’s like a subset of a table and can be used for retrieving data as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. Views do not exist in the database unless you add an index.
What is an index?
A physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. Indexes are used to speed up queries.
What is a linked server?
Is when you add other SQL Server to a Group and query both the SQL Server databases using T-SQL Statements. With a linked server, you can create very clean, easy-to-follow SQL statements that allow remote data to be retrieved, joined and combined with local data.