Concept explainers
7.3 (Contacts
books.sql code:
import panda as pd
import sqlite3
connection = sqlite3.connect('books.db')
pd.options.display.max_columns = 10
pd.read_sql("SELECT * FROM authors",connection)
df = pd.read_sql( "SELECT * FROM authors",connection)
DROP TABLE IF EXISTS author_ISBN;
DROP TABLE IF EXISTS titles;
DROP TABLE IF EXISTS authors;
CREATE TABLE authors (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
first TEXT NOT NULL,
last TEXT NOT NULL
);
CREATE TABLE titles (
isbn TEXT NOT NULL,
title TEXT NOT NULL,
edition INTEGER NOT NULL,
copyright TEXT NOT NULL,
PRIMARY KEY (isbn)
);
CREATE TABLE author_ISBN (
id INTEGER NOT NULL,
isbn TEXT NOT NULL,
PRIMARY KEY (id, isbn),
FOREIGN KEY (id) REFERENCES authors(id) ON DELETE CASCADE,
FOREIGN KEY (isbn) REFERENCES titles (isbn) ON DELETE CASCADE
);
PRAGMA foreign_keys = ON;
INSERT INTO authors (first, last)
VALUES
('Paul','Deitel'),
('Harvey','Deitel'),
('Abbey','Deitel'),
('Dan','Quirk'),
('Alexander', 'Wald');
INSERT INTO titles (isbn,title,edition,copyright)
VALUES
('0135404673','Intro to Python for CS and DS',1,'2020'),
('0132151006','Internet & WWW How to Program',5,'2012'),
('0134743350','Java How to Program',11,'2018'),
('0133976890','C How to Program',8,'2016'),
('0133406954','Visual Basic 2012 How to Program',6,'2014'),
('0134601548','Visual C# How to Program',6,'2017'),
('0136151574','Visual C++ How to Program',2,'2008'),
('0134448235','C++ How to Program',10,'2017'),
('0134444302','Android How to Program',3,'2017'),
('0134289366','Android 6 for Programmers',3,'2016');
INSERT INTO author_ISBN (id,isbn)
VALUES
(1,'0134289366'),
(2,'0134289366'),
(5,'0134289366'),
(1,'0135404673'),
(2,'0135404673'),
(1,'0132151006'),
(2,'0132151006'),
(3,'0132151006'),
(1,'0134743350'),
(2,'0134743350'),
(1,'0133976890'),
(2,'0133976890'),
(1,'0133406954'),
(2,'0133406954'),
(3,'0133406954'),
(1,'0134601548'),
(2,'0134601548'),
(1,'0136151574'),
(2,'0136151574'),
(4,'0136151574'),
(1,'0134448235'),
(2,'0134448235'),
(1,'0134444302'),
(2,'0134444302'
Step by stepSolved in 5 steps with 4 images
- createDatabaseOfProfiles(String filename) This method creates and populates the database array with the profiles from the input file (profile.txt) filename parameter. Each profile includes a persons' name and two DNA sequences. 1. Reads the number of profiles from the input file AND create the database array to hold that number profiles. 2. Reads the profiles from the input file. 3. For each person in the file 1. creates a Profile object with the information from file (see input file format below). 2. insert the newly created profile into the next position in the database array (instance variable).arrow_forwardJAVA 8.13 LAB: Movie show time display Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program…arrow_forwardPlease help me write the following function (see the photos for context of the problem): follow_trail(filename, treasure_map, start_row, start_col): Takes as inputs a string corresponding to a filename, a list of lists corresponding to a treasure map, and two non-negative integers representing a row and column index. Follows the trail in the given treasure map, starting at the given row and column index. Following the trail means to look at each character of the trail and perform the appropriate operation for that character: '>', '<', 'v', ' ∧': Continues following the trail by moving to the character to the right, left, below or above the current trail character, respectively. '.': Creates a new map file, with 'new_' prepended to the current map filename, and stores the same treasure map but with an X at the current position. Then, returns a tuple of three elements: the first being -1, and the latter two being the current row and column index. '*': Returns a tuple of three…arrow_forward
- AHPA #11: Changing Grades * * Create a C function (switcher) that will receive a pointer to the finalExams array, using only pointers look for D scores and boost them to C scores. (ouput should be same as picture)arrow_forward2.14 LAB - Alter Movie table The Movie table has the following columns: • ID - positive integer • Title - variable-length string • Genre - variable-length string • RatingCode - variable-length string • Year - integer Write ALTER statements to make the following modifications to the Movie table: 1. Add a Producer column with VARCHAR data type (max 50 chars). 2. Remove the Genre column. 3. Change the Year column's name to Release Year, and change the data type to SMALLINT.arrow_forward2.3) Which one is not one of the definitions of a NULL value?a) The attribute does not apply to this tuple (i.e. Not Applicable → NA)b) The data type is not suitable for the entry datac) The attribute value for this tuple is unknownd) The attribute value for this tuple will be determined latere) The value is known but absent2.4) Which below statement is not true for indexes?a) Each table may contain at most one clustered indexb) Each table may contain none to many non-clustered indexc) Actual data is kept in the leaf of non-clustered indexd) Indexes are used to store data and allow efficient data retrievale) Non-clustered indexes increase data retrieval performance but decreases data modification performance2.5) Which below is not one of the isolation levels in transaction processing?a) Consistent read b) Read uncommitted c) Read committed d) Repeatable read e) Serializablearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education