Prepared by:<br />Noha Mostafa Bakry<br />Introduction to relational database<br />
Where are relational databases?<br />You cannot avoid it and it’s everywhere!<br />You can say it actually makes the curre...
What are relational databases?<br />A relational database stores all its data inside tables, and nothing more. <br />All o...
Create relational database?<br />
To create table must determine field name and data type and select primary key for table which must be unique and used for...
Table 2 contain ID as foreign key<br />
Relation between tables<br />1-one to one .<br />2-one to many.<br />3 – many to many.<br />
One to one<br />In one-to-one relationship, two tables are associated in such a way that each record in first table can ha...
One to many<br />In one-to-many relationship, two tables are associated in such a way that each record in the first table ...
Many  to many<br />In many-to-many relationship, two tables are associated in such a way that each record in the first tab...
Relation between tables in our example is one to many.<br />
What is E-R diagram?<br />Short  for entity relationship diagram.<br />Used to represent  relations between tables and  re...
What is Query ? <br />A database query is a request for information from a database.<br />
normalization<br /><ul><li> Normalization is the process of efficiently organizing data in a database.
  There are two goals of the normalization process: </li></ul>  1-eliminating redundant data ( storing the same     data i...
First normal form<br /><ul><li>Eliminate duplicative  columns  from the same table.
Create separate tables for each group of related data and identify each rowwith a unique column or set of columns (the pri...
Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
Create relationships between these new tables and their predecessors through the use of foreign keys. </li></li></ul><li>T...
Remove columns that are not dependent upon the primary key. </li></li></ul><li>SQL Basics<br /><ul><li>Data Manipulation L...
UPDATE PersonsSET Address='Nissestien 67', City='Sandnes'WHERE LastName='Tjessem' AND FirstName='Jakob‘<br />DELETE FROM P...
Upcoming SlideShare
Loading in …5
×

Intro To DataBase

1,187 views

Published on

Event #3 for DevMix Team

Published in: Education
  • Be the first to comment

Intro To DataBase

  1. 1. Prepared by:<br />Noha Mostafa Bakry<br />Introduction to relational database<br />
  2. 2. Where are relational databases?<br />You cannot avoid it and it’s everywhere!<br />You can say it actually makes the current society and your life work!<br />Banking/Credit card /Social Security Info…<br />Online shopping/booking…<br />
  3. 3.
  4. 4.
  5. 5.
  6. 6. What are relational databases?<br />A relational database stores all its data inside tables, and nothing more. <br />All operations on data are done on the tables themselves or produces another tables as the result. <br />You never see anything except for tables.<br />
  7. 7.
  8. 8. Create relational database?<br />
  9. 9.
  10. 10. To create table must determine field name and data type and select primary key for table which must be unique and used for relations .<br />
  11. 11. Table 2 contain ID as foreign key<br />
  12. 12. Relation between tables<br />1-one to one .<br />2-one to many.<br />3 – many to many.<br />
  13. 13. One to one<br />In one-to-one relationship, two tables are associated in such a way that each record in first table can have only one matching record in second table, and each record in second table can have only one matching record in first table.<br />
  14. 14.
  15. 15. One to many<br />In one-to-many relationship, two tables are associated in such a way that each record in the first table can have many matching records in second table, but a record in second table has only one matching record in first table.<br />
  16. 16.
  17. 17. Many to many<br />In many-to-many relationship, two tables are associated in such a way that each record in the first table can have many matching records in second table, and a record in second table can have many matching records in first table.<br />
  18. 18.
  19. 19. Relation between tables in our example is one to many.<br />
  20. 20. What is E-R diagram?<br />Short for entity relationship diagram.<br />Used to represent relations between tables and relation types.<br />
  21. 21. What is Query ? <br />A database query is a request for information from a database.<br />
  22. 22.
  23. 23. normalization<br /><ul><li> Normalization is the process of efficiently organizing data in a database.
  24. 24. There are two goals of the normalization process: </li></ul> 1-eliminating redundant data ( storing the same data in more than one table) .<br /> 2- ensuring data dependencies (only storing related data in a table).<br />
  25. 25. First normal form<br /><ul><li>Eliminate duplicative columns from the same table.
  26. 26. Create separate tables for each group of related data and identify each rowwith a unique column or set of columns (the primary key). </li></li></ul><li> Second normal form<br /><ul><li>Meet all the requirements of the first normal form.
  27. 27. Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
  28. 28. Create relationships between these new tables and their predecessors through the use of foreign keys. </li></li></ul><li>Third normal form<br /><ul><li>Meet all the requirements of the second normal form.
  29. 29. Remove columns that are not dependent upon the primary key. </li></li></ul><li>SQL Basics<br /><ul><li>Data Manipulation Language (DML) (SELECT-UPDATE-DELETE</li></ul>-INSERT)<br /><ul><li>Data Definition Language (DDL)(Create Data Base-Alter Data Base-Create Table-Alter Table-Drop Table)</li></li></ul><li>Examples <br />SELECT LastName,FirstNameFROM Persons<br />SELECT * FROM Persons<br />SELECT DISTINCT City FROM Persons<br />SELECT * FROM PersonsWHERECity='Sandnes‘<br />SELECT * FROM PersonsWHEREFirstName='Tove'ANDLastName='Svendson‘<br />INSERT INTO PersonsVALUES(4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')<br />INSERT INTO Persons (P_Id, LastName, FirstName)VALUES (5, 'Tjessem', 'Jakob')<br />
  30. 30. UPDATE PersonsSET Address='Nissestien 67', City='Sandnes'WHERE LastName='Tjessem' AND FirstName='Jakob‘<br />DELETE FROM PersonsWHERELastName='Tjessem' <br />AND FirstName='Jakob‘<br />
  31. 31. Any Questions ?<br />

×