Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Say that you are designing software to handle tables of data (like a spreadsheet

ID: 3595171 • Letter: S

Question

Say that you are designing software to handle tables of data (like a spreadsheet or statistical analysis software) and want to create a table of data object (like a matrix or a data frame) which supports the following functionality:

Please answer this question, thank you.

e populate the table from a .csv file e retrieve the number of rows from this table retrieve the number of columns from this table retrieve a specific row of the table, returned as an array retrieve a specific column of the table, returned as an array retrieve all the data, returned as a two dimensional array change a value at a specific row and specific column to a given new value Write a Java interface to design this object, where the data type in the table is specified by a generic parameter (if you cannot figure out generics, assume all data values will be of type double for reduced credit). Note that interfaces do not define constructors. DO NOT implement the interface with an abstract or implementing class, only create the interface class. You must decide on effective and practical names, parameters, and return types.

Explanation / Answer

A. populate the table from a .csv file

1. Prepare the CSV file to have the fields in the same order as the MySQL table fields.

2. Remove the header row from the CSV (if any), so that only the data is in the file.

3. Go to the phpMyAdmin interface.

4. Select the table in the left menu.

5. Click the import button at the top.

6. Browse to the CSV file.

B. retrive number of rows from this table

Notes:

COUNT(1) = COUNT(*) = COUNT(PrimaryKey) just in case

Edit:

SQL Server example (1.4 billion rows, 12 columns)

1 runs, 5:46 minutes, count = 1,401,659,700

C. Retrive a column from this table

D.retrieve a specific row of the table, returned as an array

require_once("DbConnect.php");

$sql = "SELECT artist, title, label, albumyear, picture FROM historylist ORDER BY date_played DESC LIMIT 3";

$result = $db->query($sql);

E.retrieve a specific column of the table, returned as an array

<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

print("Fetch the first column from the first row in the result set: ");
$result = $sth->fetchColumn();
print("name = $result ");

print("Fetch the second column from the second row in the result set: ");
$result = $sth->fetchColumn(1);
print("colour = $result ");
?>

F.Retrive all the data using two dimentinal array

g change the value of specific row to give a new value

UPDATE users SET password = "thisisabadidea" WHERE id = 3; UPDATE blog_posts SET view_count = 1923 WHERE title = "SQL is Awesome";

UPDATE some_table SET field1='Value 1' WHERE primary_key = 7; The WHERE clause limits which rows are updated. Generally you'd use this to identify your table's primary key (or ID) value, so that you're updating only one row. The SETclause tells MySQL which columns to update

E.retrieve a specific column of the table, returned as an array

<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

print("Fetch the first column from the first row in the result set: ");
$result = $sth->fetchColumn();
print("name = $result ");

print("Fetch the second column from the second row in the result set: ");
$result = $sth->fetchColumn(1);
print("colour = $result ");
?>

F.Retrive all the data using two dimentinal array

g change the value of specific row to give a new value

UPDATE users SET password = "thisisabadidea" WHERE id = 3; UPDATE blog_posts SET view_count = 1923 WHERE title = "SQL is Awesome";

UPDATE some_table SET field1='Value 1' WHERE primary_key = 7; The WHERE clause limits which rows are updated. Generally you'd use this to identify your table's primary key (or ID) value, so that you're updating only one row. The SETclause tells MySQL which columns to update

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote