Found 4378 Articles for MySQL

Sixth Normal Form (6NF)

Amit Diwan
Updated on 15-Jun-2020 14:18:09

4K+ Views

In 6NF, the relation variable is decomposed into irreducible components. A relation is in 6NF, only if, It is in 5NF, and every join dependency on the relation is trivialLet us see an example −Enrollment_NoNameMarksThe possible join dependencies for the above would be −{Enrollment_No, Marks}{Enrollment_No, Name}In Sixth Normal Form (6NF), it would be decomposed to −Enrollment_NoNameEnrollment_No MarksLet us see another example −Student_IDStudent_FirstNameStudent_LastNameMarksS01TomAlter90S02JacobWatson80S03HarrySmith85Let us decompose the table −Student_IDStudent_FirstNameS01TomS02JacobS03HarryStudent_IDStudent_LastNameS01AlterS02WatsonS03SmithStudent_IDMarksS0190S0280                     S03                   85Now the above tables are in 6NF, but as you can guess on your know that ... Read More

Unique Key in RDBMS

Alex Onsman
Updated on 15-Jun-2020 14:19:07

674 Views

Many users consider Primary Key as Unique Key, since both uniquely identify a table, but Unique Key is different from Primary Key. Unique Key accepts null values and Primary Key cannot have null.Let us compare Primary Key and Unique Key and understand its concept −UsageA Unique Key is used to prevent duplicate values in a column. Primary Key provided uniqueness to a table.NULL ValuesA primary key cannot accept NULL values; this makes Primary Key different from Unique Key, since Unique Key allows one value as NULL value.VolumeA table can only have a single Primary Key, whereas a Unique Key can ... Read More

RDBMS terminologies

Amit Diwan
Updated on 15-Jun-2020 14:23:10

8K+ Views

RDMS Terminologies include Database, Table, Columns, etc. Let us see them one by one −DatabaseDatabase is a collection of tables like , , etc.TableA table is a collection of rows and columns , for example, StudentIdStudentNameStudentRank052Tom1035David2077John3ColumnColumn is in a table −RowRow is also called a tuple in RDBMS. A relation in a database has rows and columns.Primary KeyEvery table has one Primary key and cannot have null values.For example, ProjectID is a primary key in Project Table, since it uniquely identifies the project:ProjectIDProjectNameP01Cluster Grouping SystemP02Hospital Management SystemForeign KeyIf you want to link two tables, use Foreign Key.For example, Employee table has DEPT_ID ... Read More

Foreign Key in RDBMS

Ricky Barnes
Updated on 15-Jun-2020 13:40:33

3K+ Views

A Foreign Key creates a link between tables. It references the primary key in another table and links it.For example, the DeptID in the Employee table is a foreign key −EmpIDEmpNameEmpAgeDeptIDDeptIDDeptNameDeptZoneThe DeptID in the Department table is a Primary Key in the Department Table.The DeptID in the Employee table is a Foreign Key in the Employee Table.The below figure represents the same −Above, you can see our two tables. The Foreign Key of the Employee table is the Primary Key of the Department table.

Alternate Key in RDBMS

Amit Diwan
Updated on 15-Jun-2020 14:21:14

4K+ Views

Alternate Key or Secondary Key is the key that has not been selected to be the primary key, but are candidate keys. However, it is considered a candidate key for the primary key.A candidate key not selected as a primary key is called alternate or secondary key. Candidate key is an attribute or set of attributes that you can consider as a Primary key.Let us see an example −Student_IDStudent_EnrollStudent_NameStudent_Email0962717Manishaaa@gmail.com0552655Mananabc@gmail.com0672699Shreyaspqr@gmail.comAbove, Student_ID, Student_Enroll and Student_Email are the candidate keys. They are considered candidate keys since they can uniquely identify the student record. Select any one of the candidate key as the primary. Rest ... Read More

Candidate Key in RDBMS

Ricky Barnes
Updated on 15-Jun-2020 13:38:01

1K+ Views

Each table has only a single primary key. Each relation may have one or more candidate key. One of these candidate key is called Primary Key. Each candidate key qualifies for Primary Key. Therefore candidates for Primary Key is called Candidate Key.Candidate key can be a single column or combination of more than one column. A minimal super key is called a candidate key.ExampleEmployeeID and EmployeeEmail, both can be a Primary key; therefore both are candidate keys. Select any of the as Primary Key for your table, since a table can have only a single Primary Key.Let us see another example ... Read More

Surrogate Key in RDBMS

Ricky Barnes
Updated on 15-Jun-2020 13:48:52

827 Views

A Surrogate Key’s only purpose is to be a unique identifier in a database, for example, incremental key, GUID, etc. It hasSurrogate Key has no actual meaning and is used to represent existence. It has an existence only for data analysis.ExampleKeyProductIDPrice505_921987200698_561256170304_571898250458_661666110Above, the surrogate key is Key in the table.Other ExamplesSome other examples of a Surrogate Key −Counter can also be shown as Surrogate Key.System date/time stampRandom alphanumeric string.

Data and structural independence

Alex Onsman
Updated on 15-Jun-2020 13:47:58

2K+ Views

Structural IndependenceStructural independence exists when changes in the database structure do not affect DBMS ability to access data.Structural dependence exists when changes in the database structure do not affect DBMS ability to access data.Data IndependenceThe changes done in the lower level will not affect the upper layers. The two types are −Physical Data IndependenceLogical Data IndependenceLet us begin with Physical Data Independence −Physical Data IndependenceModify physical schema without affecting the schema or logical data. It is easier to achieve.It is achieved by the internal level of the database and mapping from the logical level to the internal level. The Conceptual Schema ... Read More

Super Key in RDBMS

Ricky Barnes
Updated on 15-Jun-2020 13:46:26

2K+ Views

Super Key is an attribute (or a set of attributes) that uniquely identify a tuple i.e. an entity in entity set.It is a superset of Candidate Key, since Candidate Keys are selected from super key.ExampleLet us see an example −Student_IDStudent_EnrollStudent_NameStudent_EmailS024545Daveddd@gmail.comS344541Jackjjj@gmail.comS224555Markmmm@gmail.comThe following are the super keys for the above table −{Student_ID}{Student_Enroll}{Student_Email}{Student_ID, Student_Enroll}{Studet_ID, Student_Name}{Student_ID, Student_Email}{Student_Name, Student_Enroll}{Student_ID, Student_Enroll, Student_Name}{Student_ID, Student_Enroll, Student_Email}{Student_ID, Student_Enroll, Student_Name, Student_Email}The following would be the candidate key from the above −{Student_ID}{Student_Enroll}{Student_Email}Read More

Fourth Normal Form (4NF)

Alex Onsman
Updated on 15-Jun-2020 13:41:50

4K+ Views

What is 4NF?The 4NF comes after 1NF, 2NF, 3NF, and Boyce-Codd Normal Form. It was introduced by Ronald Fagin in 1977.To be in 4NF, a relation should be in Bouce-Codd Normal Form and may not contain more than one multi-valued attribute.ExampleLet us see an example −Movie_NameShooting_LocationListingMovieOneUKComedyMovieOneUKThrillerMovieTwoAustraliaActionMovieTwoAustraliaCrimeMovieThreeIndiaDramaThe above is not in 4NF, sinceMore than one movie can have the same listingMany shooting locations can have the same movieLet us convert the above table in 4NF −Movie_NameShooting_LocationMovieOneUKMovieOneUKMovieTwoAustraliaMovieTwoAustraliaMovieThreeIndiaMovie_NameListingMovieOneComedyMovieOneThrillerMovieTwoActionMovieTwoCrimeMovieThreeDramaNow the violation is removed and the tables are in 4NF.

Advertisements