{"id":455,"date":"2023-01-25T13:31:17","date_gmt":"2023-01-25T13:31:17","guid":{"rendered":"http:\/\/learnlearn.uk\/ibcs\/?page_id=455"},"modified":"2023-01-25T13:31:17","modified_gmt":"2023-01-25T13:31:17","slug":"flat-file-vs-relational-databases","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/","title":{"rendered":"Flat file vs Relational Databases"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Video<\/h2>\n<div class=\"tabcontent\">\n\n<p>Video Introduction<\/p>\n<p>This is a great (though long) introductory lecture into relational databases.<\/p>\n<div class=\"nv-iframe-embed\">\n<div class=\"container-lazyload preview-lazyload container-youtube js-lazyload--not-loaded\"><a href=\"https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE\" class=\"lazy-load-youtube preview-lazyload preview-youtube\" data-video-title=\"Introduction to Database Management Systems 1: Fundamental Concepts\" title=\"Play video &quot;Introduction to Database Management Systems 1: Fundamental Concepts&quot;\">https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE<\/a><noscript>Video can&#8217;t be loaded because JavaScript is disabled: <a href=\"https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE\" title=\"Introduction to Database Management Systems 1: Fundamental Concepts\">Introduction to Database Management Systems 1: Fundamental Concepts (https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE)<\/a><\/noscript><\/div>\n<\/div>\n\n<\/div><h2 class=\"tabtitle\">Flat Files<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Flat File Databases<\/h3>\n<p>A flat file database consists of data stored within a plain text file. Records are stored one per line and each attribute of the record is separated by a delimiter &#8211; often in the form of a comma or tab.<\/p>\n<p>A flat file is the simplest form of database and simplicity is its biggest advantage.<\/p>\n<ul>\n<li>The database has little overhead as the only metadata in the file are the delimiters<\/li>\n<li>The database can be read easily by human beings or by many different programs<\/li>\n<\/ul>\n<div id=\"attachment_1789\" style=\"width: 621px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/flat-file-database-example.png\"><img aria-describedby=\"caption-attachment-1789\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-1789 size-full\" src=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/flat-file-database-example.png\" alt=\"\" width=\"611\" height=\"229\" \/><\/a><p id=\"caption-attachment-1789\" class=\"wp-caption-text\">An example flat file database, generated automatically using <a href=\"https:\/\/www.mockaroo.com\/\">Mockaroo<\/a>.<\/p><\/div>\n\n<\/div><h2 class=\"tabtitle\">Limitations of Flat Files<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Limitations of file based systems<\/h3>\n<p>One of the quickest and easist ways to save data persistently (so that you don&#8217;t lose data when the computer is switched off or the program you are running closes) is to save the data to a text or csv file. The files are great if you are just &#8216;dumping&#8217; the data (such as writing to an error log) or saving configuration settings, but when you start to handle large amounts of data or when you need to be able to edit or search the data you run into problems.<\/p>\n<p>Limitations<\/p>\n<ul>\n<li>Text data must be read sequentially, which means that if you have thousands(or even millions) of items in the file it is going to take a long time to read the data.<\/li>\n<li>There is no in-built search function, so you have to search through data manually.<\/li>\n<li>You often cannot edit a single line, you have to rewrite the entire file.<\/li>\n<li>Filtering is slow and difficult &#8211; you have to import all the data into an 2 dimensional array and filter the data from there.<\/li>\n<li>Because there is no way of establishing relationships between the data entered, there is often large amounts of redundancy in the data (duplication)<\/li>\n<li>As the metadata is stored externally to the database <strong>data dependence<\/strong> occurs &#8211; where the integrity of the programs become dependent on the formatting of the data.<\/li>\n<\/ul>\n<p>This means that file-based systems usually only the most appropriate solution for the simplest of situations and a relational database is more appropriate.<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Relational Databases<\/h2>\n<div class=\"tabcontent\">\n\n<p><strong>Relational Database Model<\/strong><\/p>\n<p>Relational database work by splitting data about different entities (types of things) into separate relations (tables). Each relation only contains data about one entity and relationships (connections) are made between each of the relations through the use of primary and foreign keys.<\/p>\n<div id=\"attachment_1790\" style=\"width: 671px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/Untitled-Diagram-8.png\"><img aria-describedby=\"caption-attachment-1790\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1790\" src=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/Untitled-Diagram-8.png\" alt=\"\" width=\"661\" height=\"151\" \/><\/a><p id=\"caption-attachment-1790\" class=\"wp-caption-text\">A simple design for the relations(tables) in a relational database.<\/p><\/div>\n<p>Each table still only contains the actual data about the entity itself:<\/p>\n<p><strong>Pupil Table<\/strong><\/p>\n<p><a href=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/pupil-table-example-data.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1791\" src=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/pupil-table-example-data.png\" alt=\"\" width=\"271\" height=\"69\" \/><\/a><\/p>\n<p><strong>Teacher Table<\/strong><\/p>\n<p><a href=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/teacher-table.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1792\" src=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/teacher-table.png\" alt=\"\" width=\"371\" height=\"57\" \/><\/a><\/p>\n<p><strong>Class Table<\/strong><\/p>\n<p><a href=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/class-table-example-data.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1793\" src=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/class-table-example-data.png\" alt=\"\" width=\"247\" height=\"51\" \/><\/a><\/p>\n<p>It&#8217;s import to note that the tables themselves do not contain any metadata detailing what data is stored in each column. This is stored in a separate part of the database known as the <strong>Data Dictionary<\/strong>.<\/p>\n<p>By separating the data into separate tables there is less duplication, therefore less chance of corruption of data. However due to the relationship information stored in the data dictionary you can use a language called <strong>Structured Query Language<\/strong>\u00a0(SQL) to perform powerful and complex queries, combining information from multiple tables.<\/p>\n<p>Among other things SQL allows :<\/p>\n<ul>\n<li>Sorting of data<\/li>\n<li>Searching of data<\/li>\n<li>Filtering of data<\/li>\n<li>Combining data from multiple tables using join queries<\/li>\n<\/ul>\n\n<\/div><h2 class=\"tabtitle\">RDMS<\/h2>\n<div class=\"tabcontent\">\n\n<p>The creation, maintenance and querying of a relational database is controlled by a software system known as a Relational Database Management System.<\/p>\n<p><strong>Features of Relational Database Management Systems.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Features of a DBMS:<\/li>\n<li>Allows the creation of database &amp; tables<\/li>\n<li>Management of database and tables<\/li>\n<li>In-built security measures<\/li>\n<li>Developer console<\/li>\n<li>Query Builder<\/li>\n<li>Multiple views (e.g. forms &amp; reports) and access levels<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Resources<\/h2>\n<div class=\"tabcontent\">\n\n<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1-GHHlgVRMu6XnmoNllIrcTxYOkZLRajXVz3j6tRLiBA\/edit?usp=sharing\">Teacher Presentation<\/a><\/p>\n<p>&nbsp;<\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Video Introduction This is a great (though long) introductory lecture into relational databases. https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GEVideo can&#8217;t be loaded because JavaScript is disabled: Introduction to Database Management Systems 1: Fundamental Concepts (https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE) Flat File Databases A flat file database consists of data stored within a plain text file. Records are stored one per line and each attribute&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Flat file vs Relational Databases<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Flat file vs Relational Databases - IB Computer Science<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flat file vs Relational Databases - IB Computer Science\" \/>\n<meta property=\"og:description\" content=\"Video Introduction This is a great (though long) introductory lecture into relational databases. https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GEVideo can&#8217;t be loaded because JavaScript is disabled: Introduction to Database Management Systems 1: Fundamental Concepts (https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE) Flat File Databases A flat file database consists of data stored within a plain text file. Records are stored one per line and each attribute&hellip;&nbsp;Read More &raquo;Flat file vs Relational Databases\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\" \/>\n<meta property=\"og:site_name\" content=\"IB Computer Science\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/flat-file-database-example.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\",\"name\":\"Flat file vs Relational Databases - IB Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#website\"},\"datePublished\":\"2023-01-25T13:31:17+00:00\",\"dateModified\":\"2023-01-25T13:31:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"IB Computer Science\",\"item\":\"https:\/\/learnlearn.uk\/ibcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flat file vs Relational Databases\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/\",\"name\":\"IB Computer Science\",\"description\":\"- learnlearn..uk\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/ibcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#organization\",\"name\":\"IB Computer Science\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png\",\"width\":300,\"height\":41,\"caption\":\"IB Computer Science\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flat file vs Relational Databases - IB Computer Science","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/","og_locale":"en_GB","og_type":"article","og_title":"Flat file vs Relational Databases - IB Computer Science","og_description":"Video Introduction This is a great (though long) introductory lecture into relational databases. https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GEVideo can&#8217;t be loaded because JavaScript is disabled: Introduction to Database Management Systems 1: Fundamental Concepts (https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE) Flat File Databases A flat file database consists of data stored within a plain text file. Records are stored one per line and each attribute&hellip;&nbsp;Read More &raquo;Flat file vs Relational Databases","og_url":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/","og_site_name":"IB Computer Science","og_image":[{"url":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2021\/02\/flat-file-database-example.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/","url":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/","name":"Flat file vs Relational Databases - IB Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#website"},"datePublished":"2023-01-25T13:31:17+00:00","dateModified":"2023-01-25T13:31:17+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/ibcs\/flat-file-vs-relational-databases\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"IB Computer Science","item":"https:\/\/learnlearn.uk\/ibcs\/"},{"@type":"ListItem","position":2,"name":"Flat file vs Relational Databases"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/ibcs\/#website","url":"https:\/\/learnlearn.uk\/ibcs\/","name":"IB Computer Science","description":"- learnlearn..uk","publisher":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/ibcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/ibcs\/#organization","name":"IB Computer Science","url":"https:\/\/learnlearn.uk\/ibcs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png","contentUrl":"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png","width":300,"height":41,"caption":"IB Computer Science"},"image":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/ibcs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Video Introduction This is a great (though long) introductory lecture into relational databases. https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GEVideo can&#8217;t be loaded because JavaScript is disabled: Introduction to Database Management Systems 1: Fundamental Concepts (https:\/\/www.youtube.com\/watch?v=6u2zsJOJ_GE) Flat File Databases A flat file database consists of data stored within a plain text file. Records are stored one per line and each attribute&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/455"}],"collection":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/comments?post=455"}],"version-history":[{"count":1,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/455\/revisions"}],"predecessor-version":[{"id":456,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/455\/revisions\/456"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/media?parent=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}