{"id":8604,"date":"2023-05-03T15:17:02","date_gmt":"2023-05-03T13:17:02","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?p=8604"},"modified":"2026-05-29T16:29:15","modified_gmt":"2026-05-29T14:29:15","slug":"pr2en14-sql","status":"publish","type":"post","link":"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/","title":{"rendered":"PR2EN14: SQL"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Lab_materials\" >Lab materials<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Data_model\" >Data model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Lab_task_1_W15-1_Add_yourself_to_the_database\" >Lab task 1 [W15-1]: Add yourself to the database<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Requirements\" >Requirements<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Lab_task_2_Retrieving_data\" >Lab task 2: Retrieving data<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Requirements-2\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Task_2_part_1_W15-2_Basic_data_retrieval_queries\" >Task 2 part 1 [W15-2]: Basic data retrieval queries<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Task_2_part_2_W15-3_Retrieving_and_combining_data_from_multiple_data_tables\" >Task 2 part 2 [W15-3]: Retrieving and combining data from multiple data tables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Task_2_part_3_W15-4_Grouping_data_and_performing_calculations\" >Task 2 part 3 [W15-4]: Grouping data and performing calculations<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Extra_task_1_W15-5_Adding_yourself_to_the_database_more_reliably\" >Extra task 1 [W15-5]: Adding yourself to the database more reliably<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Information\" >Information<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Requirements-3\" >Requirements<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Extra_task_2_W15-6_Changing_existing_data\" >Extra task 2 [W15-6] : Changing existing data<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Requirements-4\" >Requirements<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#After_this_class_you_should\" >After this class, you should<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/#Additional_materials\" >Additional materials<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Lab_materials\"><\/span>Lab materials<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>Slides: <a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/slaidid-en\/2025\/14_sql.pdf\"><strong>SQL<\/strong><\/a><\/li>\n<li>Sample database:\u00a0<strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/aluskoodid\/week14-db\/cars.db\">cars.db<\/a><\/strong><\/li>\n<li>Interfacing samples: [<strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/aluskoodid\/week14-db\/sql1.c\">sql1.c<\/a><\/strong>]\u00a0\u00a0 [<strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/aluskoodid\/week14-db\/sql2.c\">sql2.c<\/a><\/strong>]\u00a0 [<strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/aluskoodid\/week14-db\/sql3.c\">sql3.c<\/a><\/strong>]<\/li>\n<\/ul>\n<p><span style=\"font-size: 22px; font-weight: bold;\">Lab tasks<\/span><\/p>\n<p>In this lab task, you are going to interface with an SQLite3 database using the <span class=\"lang:c highlight:0 decode:true crayon-inline \">libsqlite3-dev<\/span>\u00a0 library. You start out by adding data to the existing database in the first lab task and continue by querying the data in the second lab task.<\/p>\n<p>The lab has two extra tasks, first of which switches out the adding of the data. Second one introduces you to updating existing data rows.<\/p>\n<p><strong>Download the lab task database:\u00a0<a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0584\/aluskoodid\/week14-db\/study_information.db\">study_information.db<\/a><\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Data_model\"><\/span>Data model<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/04\/14_sql_data_model.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8605\" src=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/04\/14_sql_data_model.png\" alt=\"\" width=\"897\" height=\"465\" srcset=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/04\/14_sql_data_model.png 897w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/04\/14_sql_data_model-300x156.png 300w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/04\/14_sql_data_model-768x398.png 768w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Lab_task_1_W15-1_Add_yourself_to_the_database\"><\/span><span style=\"font-size: 20px; font-weight: bold;\">Lab task 1 [W15-1]: Add yourself to the database<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>NB! The task might not be doable on the P drive due to locking issues with Windows SMB shares (unable to commit changes to the database) . To get around this, store the database file on the local computer (e.g. on Desktop) for the duration of the tasks and move to P drive after completion!<\/strong><\/p>\n<p>In this part you will practice doing INSERT queries. The base task does not need to be implemented in your C code! You can use the &#8220;Execute SQL&#8221; feature in the SQLite browser.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Requirements\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li>Write down all the SQL queries you did (just as a text document)! Show the queries once all are performed and show the database. There should be a total of 5 queries!<\/li>\n<li>ID values used for the\u00a0<strong>primary key of each table<\/strong>\u00a0<span class=\"lang:c highlight:0 decode:true crayon-inline\">(students.id<\/span> , <span class=\"lang:c highlight:0 decode:true crayon-inline\">subjects.id<\/span> , <span class=\"lang:c highlight:0 decode:true crayon-inline\">declarations.id<\/span> ) must not be hardcoded into your queries! They are generated automatically by the database management system (those attributes have <strong>auto increment<\/strong> as a part of their database design with each table having a corresponding sequence generator).<\/li>\n<li>Perform the following insertions\n<ul>\n<li>Add yourself as a student into the database.<\/li>\n<li>Add a subject that you have completed into the database.<\/li>\n<li>Add 3 declarations to yourself. One to the subject that you just created and two more for subjects in the database.<\/li>\n<\/ul>\n<\/li>\n<li>Note: grades and eID do not need to be real.<\/li>\n<\/ul>\n<p>Once data is added, present the queries you performed and show you database in SQLite Browser.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Lab_task_2_Retrieving_data\"><\/span>Lab task 2: Retrieving data<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>For this lab task, you will need to write queries to retrieve data from the database. All queries need to be performed in the C program you write. You have 3 sample codes provided in the beginning of this page. Pick the one you like the most and use that as a template to writing your own queries.<\/p>\n<p>Task is divided into three separately graded parts.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Requirements-2\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li>All queries for the part you intend to present must be completed. Each part is graded individually..<\/li>\n<li>Data must be completely prepared on the database engine side &#8211; any kind of calculation (sums, averages, max etc) must be written into the SQL query. <strong>No calculations in your C code<\/strong>!<\/li>\n<li>All <strong>relevant<\/strong> data must be printed. <strong>Do not print id values<\/strong> (e.g. subject.id, declaration.id, ..)<\/li>\n<li>Queries can either be performed through a menu selectively or can just execute one after another. Up to you.<\/li>\n<li>All resources must be released by the end of the program, no leaks &#8211; check with Valgrind.<\/li>\n<\/ul>\n<h5><span class=\"ez-toc-section\" id=\"Task_2_part_1_W15-2_Basic_data_retrieval_queries\"><\/span>Task 2 part 1 [W15-2]: Basic data retrieval queries<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>First part contains basic SELECT queries.<\/p>\n<p><strong>Query 1:<\/strong> Find all subjects that are less than 6 credits<\/p>\n<p><strong>Query 2:<\/strong> Find all subjects that have an exam, ordered by the number of credits from lowest to highest.<\/p>\n<p>Note: Query 1 and 2 are independent of each other. Do not tie them together.<\/p>\n<p><strong>Example output<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:2 nums:false lang:c highlight:0 decode:true\">risto@risto-lt:~\/git_prj\/iax058x-instructor-resources\/pr2\/wk14_sql$ .\/task_p1\r\nT2 P1 Q1: Subjects less than 6 ECTS\r\n\r\n id     code   credits                  name_et                 \r\n5     HHF3080    3       Filosoofia                               \r\n7     HPP0300    3       Insenerieetika                           \r\n8     ITX0130    2       Elements of AI - Tehisintellekti baaskursus \r\n9     ITC8120    3       Kurivara                                 \r\n11    IDU0230    5       Andmebaasid II                           \r\n\r\n\r\nT2 P1 Q2: Subjects having an exam, ordered by ETS\r\n\r\n\r\n id     code                   name_et                 credits      Assessment     \r\n9     ITC8120    Kurivara                                 3        Examination          \r\n11    IDU0230    Andmebaasid II                           5        Examination          \r\n2     IAX0010    Diskreetne matemaatika                   6        Exam                 \r\n3     IAX0043    Arvutid                                  6        Exam                 \r\n4     IAS0090    Algoritmid ja andmestruktuurid           6        Exam                 \r\n6     YMX0231    Matemaatiline anal\u00fc\u00fcs I                  6        Exam                 \r\n10    ITI0206    Andmebaasid I                            6        Examination<\/pre>\n<h5><span class=\"ez-toc-section\" id=\"Task_2_part_2_W15-3_Retrieving_and_combining_data_from_multiple_data_tables\"><\/span>Task 2 part 2 [W15-3]: Retrieving and combining data from multiple data tables<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Second part contains more complex SELECT queries where you have to use JOIN and double JOIN to merge data from multiple tables together through their PK-FK key-pairs.<\/p>\n<p><strong>Query 1:<\/strong> Find all grades for students whose first name is \u201cMarko\u201d<\/p>\n<p><strong>Query 2:<\/strong> Find all classes you\u2019ve completed, show with grades, starting from the highest grade.<\/p>\n<p>Note: Query 1 and 2 are independent of each other. Do not tie them together.<\/p>\n<p><strong>Example output<\/strong><\/p>\n<p>NB! The task requires you to query your own data! In the example, an existing student from the database is used so you can see the expected output columns.<\/p>\n<pre class=\"theme:cisco-router toolbar:2 nums:false lang:c highlight:0 decode:true\">risto@risto-lt:~\/git_prj\/iax058x-instructor-resources\/pr2\/wk14_sql$ .\/task_p2\r\nT2 P2 Q1: All grades of student 'Marko'\r\n\r\n    eid        fname      lname   subject_id  grade  \r\n39012110145  Marko       Mets        2           4        \r\n39012110145  Marko       Mets        5           0        \r\n39012110145  Marko       Mets        6           3        \r\n39012110145  Marko       Mets        7           5        \r\n39012110145  Marko       Mets        9           3        \r\n39111190001  Marko       Mets        3           5        \r\n39111190001  Marko       Mets        4           4        \r\n\r\n\r\nT2 P2 Q2: List your grades (replaced for demonstration purposes with one Marko Mets)\r\n\r\n    eid        fname      lname                  name_et                 grade  \r\n39111190001  Marko       Mets        Arvutid                               5         \r\n39111190001  Marko       Mets        Algoritmid ja andmestruktuurid        4<\/pre>\n<h5><span class=\"ez-toc-section\" id=\"Task_2_part_3_W15-4_Grouping_data_and_performing_calculations\"><\/span>Task 2 part 3 [W15-4]: Grouping data and performing calculations<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>In this part we will practice data aggregation for calculating for our SELECT queries. We will use both JOIN, GROUP BY and additional functions for calculating results.<\/p>\n<p><strong>Query:<\/strong> Find each students total earned credits and weighted average grade<\/p>\n<p><strong>Example output<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:2 nums:false lang:c highlight:0 decode:true\">risto@risto-lt:~\/git_prj\/iax058x-instructor-resources\/pr2\/wk14_sql$ .\/task_p3\r\nT2 P3: Total ECTS and weighted average of all students\r\n\r\n    eid        fname      lname     ECTS   Average grade  \r\n30610072188  Andres      Seeder      21       4.14             \r\n39012110145  Marko       Mets        21       3.14             \r\n39111190001  Marko       Mets        12       4.5              \r\n39404101291  Taavi       Kuusk       35       4.49             \r\n49011162694  Sirje       Vakra       28       4.0              \r\n49212043256  Anneli      Ojamaa      36       0.83             \r\n49311121214  Tiina       M\u00e4nd        12       5.0              \r\n55506211816  Marko       Rebane      0        -                \r\n60102039403  Siim        Kivi        30       1.2              \r\n60210031677  Anneli      Oja         17       2.65             \r\n68604152911  Doris       Raud        12       5.0<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Extra_task_1_W15-5_Adding_yourself_to_the_database_more_reliably\"><\/span>Extra task 1 [W15-5]: Adding yourself to the database more reliably<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>In the base task 1, likely you added data by just observing the values and hardcoding everything in. In a production database, this wouldn&#8217;t be feasible.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Information\"><\/span>Information<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>For a better solution, we have 2 different paths we can take.<\/p>\n<p>SQL\u00a0 supports subqueries &#8211; queries that are a part of another query. For an example, we can embed a SELECT query inside of an INSERT query.<\/p>\n<p>For an example, if we want to add another car for Marko Mets\u00a0 in the sample database, we could execute<\/p>\n<pre class=\"toolbar:2 lang:tsql decode:true\">INSERT INTO cars (owner_eid, car_reg_num, tax)\r\nVALUES (\r\n\t(SELECT eid FROM person WHERE fname = 'Marko' AND lname = 'Mets'),\r\n\t'BOSS3',\r\n\t1000)<\/pre>\n<p>This of course isn&#8217;t perfect since there could be two people named Marko mets. However it will be good enough for the lab.<\/p>\n<p>A better approach would be to insert ourselves as students first. Then get the ID value from that insertion using the query <span class=\"lang:tsql decode:true crayon-inline \">SELECT last_insert_rowid();<\/span>\u00a0 This will give us the ID value of that last insertion.<\/p>\n<p>In a real database scenario this would be tied together with transactions so that there wouldn&#8217;t be race conditions (other people adding data to database before you get your id). However this is again unnecessary for us since we are using SQLite, which is an offline file based database.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Requirements-3\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li>Write the insertion to the database as a part of your C program code.<\/li>\n<li>If this code is executed again, make sure that a duplicate wouldn&#8217;t be created. Check before adding using a unique value (e.g. eID).<\/li>\n<li>You must use the auto-generated ID value value. Hardcoding any IDs into the query is not permitted.\n<ul>\n<li>You can use either one of the proposed approaches from the information section.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Extra_task_2_W15-6_Changing_existing_data\"><\/span>Extra task 2 [W15-6] : Changing existing data<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>In this task, you will practice UPDATE queries, where you will first have to identify the line and then change its attribute(s). You will need to generate and add uni-id&#8217;s to all students.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Requirements-4\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li>Generate all the students Uni-ID&#8217;s.<\/li>\n<li>Uni-IDs must be added to the database using UPDATE statements. Populate the uni_id attribute.<\/li>\n<li>Your code must work for any number of students<\/li>\n<li>You must also resolve conflicts if a Uni-ID already exists. Conflict resolution can (and should) be done in C.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"After_this_class_you_should\"><\/span>After this class, you should<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>Know how database is defined<\/li>\n<li>Know about basic data models &#8211; flat file, relational<\/li>\n<li>Understand data relations between tables<\/li>\n<li>Know the purpose of a database management systems\n<ul>\n<li>What to they do<\/li>\n<li>Database vs database management system<\/li>\n<li>some examples of widely used DBMS<\/li>\n<\/ul>\n<\/li>\n<li>Understand the basics of SQL language\n<ul>\n<li>declarative language<\/li>\n<li>syntax<\/li>\n<\/ul>\n<\/li>\n<li>Be able to write basic SQL queries for\n<ul>\n<li>data retrieval from a single table<\/li>\n<li>data retrieval and joining from two or more tables<\/li>\n<li>inserting data into a table<\/li>\n<\/ul>\n<\/li>\n<li>Know the benefits and disadvantages of online and offline databases<\/li>\n<li>Be able to link a C program to a SQLite3 database using libsql3 library<\/li>\n<li>Know that you can also interface with online SQL databases using libraries for specific database types<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Additional_materials\"><\/span>Additional materials<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>SQL reference<br \/>\n<strong><a href=\"https:\/\/www.w3schools.com\/sql\/\">https:\/\/www.w3schools.com\/sql\/<\/a><\/strong><\/li>\n<li>SQL tutorial<br \/>\n<strong><a href=\"https:\/\/www.tutorialspoint.com\/sql\/index.htm\">https:\/\/www.tutorialspoint.com\/sql\/index.htm<\/a><\/strong><\/li>\n<li>SQLite documentation<br \/>\n<strong><a href=\"https:\/\/www.sqlite.org\/docs.html\">https:\/\/www.sqlite.org\/docs.html<\/a><\/strong><\/li>\n<li>SQLite C library documentation<br \/>\n<strong><a href=\"https:\/\/www.sqlite.org\/c3ref\/intro.html\">https:\/\/www.sqlite.org\/c3ref\/intro.html<\/a><\/strong><\/li>\n<li>SQLite C tutorial<br \/>\n<strong><a href=\"https:\/\/zetcode.com\/db\/sqlitec\/\">https:\/\/zetcode.com\/db\/sqlitec\/<\/a><\/strong><\/li>\n<li>SQLite in C\/C++<br \/>\n<strong><a href=\"https:\/\/www.tutorialspoint.com\/sqlite\/sqlite_c_cpp.htm\">https:\/\/www.tutorialspoint.com\/sqlite\/sqlite_c_cpp.htm<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Lab materials Slides: SQL Sample database:\u00a0cars.db Interfacing samples: [sql1.c]\u00a0\u00a0 [sql2.c]\u00a0 [sql3.c] Lab tasks In this lab task, you are going to interface with an SQLite3 database using the libsqlite3-dev\u00a0 library. You start out by adding data to the existing database in the first lab task and continue by querying the data in the second lab &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr2en14-sql\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">PR2EN14: SQL<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75,105],"tags":[],"class_list":["post-8604","post","type-post","status-publish","format-standard","hentry","category-labs","category-pr2_en"],"_links":{"self":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/comments?post=8604"}],"version-history":[{"count":12,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8604\/revisions"}],"predecessor-version":[{"id":11423,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8604\/revisions\/11423"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=8604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/categories?post=8604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/tags?post=8604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}