<meta name='google-adsense-platform-account' content='ca-host-pub-1556223355139109'/> <meta name='google-adsense-platform-domain' content='blogspot.com'/> <!-- --><style type="text/css">@import url(//www.blogger.com/static/v1/v-css/navbar/3334278262-classic.css); div.b-mobile {display:none;} </style> </head> <body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d2110564875967830374\x26blogName\x3d%E2%99%A5+Marielle.+Yr+12+IPT\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://justdareyou.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttps://justdareyou.blogspot.com/\x26vt\x3d1537764824001591938', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe", messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER, messageHandlers: { 'blogger-ping': function() {} } }); } }); </script>



entriesaboutchatlinks

Monday, February 21, 2011
Relational Databases @ 3:04 PM

~Relational Databases~
  • The most commonly used type of database that consists of multiple tables that store particular sets of data which are related to each other hence the name.
  • Every table is divided into a series of records where each has a designated key field used to sort, index and link data between tables
  • The schema shows an overall view of the data and of the relationships between tables
  • Data can be viewed for different purposes according to search, queries or reports that are run
Part of a Relational Database
  • Entity- Is a topic or specific thing about which information is being collected.
  • Attribute-A defined property of an entity (same thing as fields in a flat file database).
  • Key Field- Any field that can be used to sort the data is a 'key field' as opposed to the primary key which is a designated field. A key is is an entity in a table that distinguishes a row of data from another or a single column or group of columns uniquely identifying a record.
  • Primary Key- Unique fields that can be an individual attribute or a combination of them but must not be null. (e.g. composite key)
  • Foreign Key- The primary key of another table and relate tables in the database to each other. A foreign key in one table is a primary key in another and vice versa.
  • Table- Information about an entity is stored in tables containing columns and rows. A row in a table is called a tuple of an entity and represents a record and a column is called the attribute. Tables relate to data contained in other tables.
Relationships


Refers to the link between the various tables and is usually made through a primary key in the primary table linking through to a field in a secondary table. There are four types of relationships:
  • One-to-One: Occurs when the primary key in one table is linked to the primary key in another, meaning that the primary key in both tables are identical. These aren't very common and achieve very little.
  • One-to-Many: Used to relate one relationship to one record in a table with many records in another. These are the most common and most practical for the majority of applications.
  • Many-to-One: Involves a lookup table taking the place of the primary key.
  • Many-to-Many: A pair of one to many relationships between two tables (e.g. students will have many classes and many classes will have many students)
This is an example of a schema: