0% found this document useful (0 votes)
126 views

IIIT Hyderabad Computer & Scripting Environment Assignment 6 - Databases

This document provides practice questions and assignment questions related to using databases in computer programming. The practice questions involve basic SQL queries like creating tables, inserting records, displaying records based on different criteria, deleting records, and taking backups using SQLite3, MySQL, and PostgreSQL. The assignment questions involve developing modular programs to perform record management operations like adding, viewing, and updating student records in a database, and implementing the programs using MySQL and PostgreSQL with proper error handling, input validation, and documentation of assumptions. Additional challenge questions involve adding password-based security to the database programs.

Uploaded by

asarvind
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

IIIT Hyderabad Computer & Scripting Environment Assignment 6 - Databases

This document provides practice questions and assignment questions related to using databases in computer programming. The practice questions involve basic SQL queries like creating tables, inserting records, displaying records based on different criteria, deleting records, and taking backups using SQLite3, MySQL, and PostgreSQL. The assignment questions involve developing modular programs to perform record management operations like adding, viewing, and updating student records in a database, and implementing the programs using MySQL and PostgreSQL with proper error handling, input validation, and documentation of assumptions. Additional challenge questions involve adding password-based security to the database programs.

Uploaded by

asarvind
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

IIIT Hyderabad Computer & Scripting Environment Assignment 6 - Databases

Assignment 6 - Databases
Practice questions
These questions are optional and for your practice only. You do not need to submit solution to these questions on courses website. 1. Create table students using sqlite3 for storing student records. You can store roll number, name and email information for each student. 2. Insert records of few students in students table. 3. Display information about student based on roll number. 4. Display information about student based on name. 5. Display information about student based on email address. 6. Display information about student with part of name. For example if students names are Saurabh and Gaurav, and part of name to search is specied as aur then display records for both Saurabh and Gaurav. 7. Display information with part name without taking case (Captial / Small) into account. 8. Delete record of particular student based on roll number 9. Take backup of database in text le containing SQL statements. 10. Restore backup of database in test.sqlite3 database. Do all the above operations using MySQL and PostgreSQL respectively. You can choose to do the operations from root user or users without password for simplicity. But you must be comfortable in setting up both MySQL and PostgreSQL database on new system from scratch. Based on time and interest do all SQL exercises mentioned on http://www.sqlzoo.net/ website.

Saurabh Barjatiya, IIIT Hyderabad

SACE - Assignment 6 - Page 1

Assignment questions
Since courses website will allow only one le submission, you have to tar programs together and upload the nal tar le as solution. 1. Complete the records example which is given as sample. Ensure following while completing the example: (a) Do not accept records with same roll numbers for two students. (b) Do not accept records with both name / email address empty. At least one among name / email must be present in each record. (c) You can save records to le in any format SQL, SQLite3, CSV, XML etc. that you prefer. Read records from le option must support reading from le saved using your program. (d) Use the same modular / function based approach in completing the program. Indentation and variable names must be proper in nal code. Unindented code or variable names like a, b, c, i, j, k, temp1, temp2, etc. will be penalized. (e) The program does not depends on any existing le / database to work. initialize database ensures that program can run without assuming anything. The nal program that you submit should also be same which does not assumes anything about system. 2. Write program same as in part (1) using MySQL. You must not perform operations using root user. Name of user and name of database should be dened at top like DATABASE is dened in class example. You can use MySQL users which do not require password to login in your program. (a) You can assume some MySQL user and some MySQL database already exist on the system. Do not assume anything about tables stored in given database. (b) In save and restore / read options you can give user option of saving records in some new table instead of le. If you provide that option then you must also provide option for listing all tables. You can always implement the save and restore functionality using SQLite3 instead of using MySQL. (c) All assumptions about pre-existing users and databases must be mentioned in le readme 2.txt. You should also mention CREATE Saurabh Barjatiya, IIIT Hyderabad SACE - Assignment 6 - Page 2

USER and CREATE DATABASE commands required to created assumed users and databases. 3. Write program same as in part (2) using PostgreSQL. If you face problem with postgreSQL authentication without password, then you can use ident authentication. Same as before all assumptinons and commands required to fullll those assumptions must be mentioned in le readme 3.txt

Saurabh Barjatiya, IIIT Hyderabad

SACE - Assignment 6 - Page 3

Challenge questions
These are for ambitious students only. It is not required for everyone to solve these. You do not have to upload solutions to these questions on courses website: 1. Write programs 2 and 3 with security support. Since shell scripts are open source, you should ask user to enter password every time he/she runs program. The password should then be used to login into MySQL and PostgreSQL databases. Do not echo the password back to user. Hint: You can use expect to supply password to mysql and psql command line programs.

Saurabh Barjatiya, IIIT Hyderabad

SACE - Assignment 6 - Page 4

You might also like