Section 1

Preview this deck

2NF (Second Normal Form)

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (14)

Section 1

(14 cards)

2NF (Second Normal Form)

Front

Rule 1- Be in 1NF Rule 2- Single Column Primary Key

Back

SET ANSI_NULLS {ON/OFF}

Front

Ansi_nulls ON - a comparison with NULL records yields UNKNOWN. Hence, no rows are returned. If you compare anything with NULL, it will result as UNKNOWN, and also the NULL = NULL comparison will be considered as UNKNOWN. You cannot compare NULL against anything. Ansi_nulls OFF - then the query will return the values. then a comparison with NULL records returns rows as a comparison that evaluate to TRUE instead of UNKNOWN. This is overriding the ISO behavior. With ANSI_NULLS OFF, the comparison with NULL records results in TRUE; hence, records are returned. When the ANSI_NULLS OFF database option is used, SQL Server consider NULLs as special values when comparing with other records.

Back

Composite Key

Front

A composite key is a primary key composed of multiple columns used to identify a record uniquely

Back

second highest salary

Front

SELECT MAX(SALARY) FROM EMPLOYEE WHERE SALARY<(SELECT MAX(SALARY) FROM EMPLOYEE)

Back

highest salary

Front

SELECT MAX(SALARY) FROM EMPLOYEE

Back

Foreign Key

Front

References the primary key of another Table! It helps connect your Tables A foreign key can have a different name from its primary key It ensures rows in one table have corresponding rows in another Unlike the Primary key, they do not have to be unique. Most often they aren't Foreign keys can be null even though primary keys can not

Back

1NF (First Normal Form)

Front

Each table cell should contain a single value. Each record needs to be unique.

Back

Nth number of highest salary using DENSE_RANK function

Front

SELECT SALARY, DENSE_RANK() OVER (ORDER BY SALARY DESC) AS SALARY_RANK FROM EMPLOYEE

Back

create empty tables with the same structure as another table

Front

select * INTO table_1 from table_2 where 1=2

Back

transitive functional

Front

A transitive functional dependency is when changing a non-key column, might cause any of the other non-key columns to change

Back

3NF (Third Normal Form)

Front

Rule 1- Be in 2NF Rule 2- Has no transitive functional dependencies

Back

pattern matching

Front

Allows wildcard characters (?, *, #), character lists, and character ranges ([A-M, Z]) to match strings using the Like operator.

Back

Top 2 salary

Front

SELECT DISTINCT TOP 2 SALARY FROM EMPLOYEE ORDER BY SALARY DESC

Back

Primary Key

Front

A primary is a single column value used to identify a database record uniquely. It has following attributes A primary key cannot be NULL A primary key value must be unique The primary key values should rarely be changed The primary key must be given a value when a new record is inserted.

Back