×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create a Program to Implement Tables in SQL Assignment Solution

June 21, 2024
Maalia Wong
Maalia Wong
🇨🇦 Canada
Computer Science
Dr. Maalia Wong, PhD in Computer Science from Lakehead University, Canada, brings 7 years of expert experience in computer science assignments, offering specialized guidance and support to students in diverse and complex areas of the field.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Focus on understanding TensorFlow's computational graph and its eager execution mode. Use pre-built functions like tf.data for efficient data pipelines.
News
The latest version of Google's machine learning library, offering improved performance, streamlined APIs, and expanded support for reinforcement learning, making it a powerful tool for AI development.

Instructions

Objective

Write a SQL assignment program to implement tables.

Requirements and Specifications

How to Create, Run, and Print Statements and Output for an SQL File

  • Download and install Oracle Express Edition 11g from the following link: https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/xe-prior-releases-5172097.html

Note: You will be required to create an account.

  • Open Notepad and type the following at the top of the file:

spool path\project2_abc.txt'

-- Include the full path. This will start logging to the specified file.

set echo on

-- This will ensure that all input and output is logged to the file.

  • Type all statements into a Notepad file (it is recommended that you do this a few statements at a time, testing as you go along). Please indicate the different sections of the project using comment lines, which can be created using two hyphens at the beginning of the comment text; e.g., “--Part I” or “--Part II” (without the quotations). Name the file using your initials as a suffix with an sql extension (e.g., project2_abc.sql).
  • Type the following at the very end of the file:

set echo off

-- This will turn off logging.

spool off

-- This will close the file.

  • Start your database using the "Start Database" option in the Oracle Database program group (from the Windows "Start button").
  • Open the SQL command line from the "Run SQL Command Line" option in the Oracle Database program group (from the Windows "Start button"). When the window opens, you will see an SQL prompt. Type the following command to connect to your database:

connect system/password

where password is the password you entered during the installation process.

  • Once connected, you may run your SQL file by typing the start command at the SQL prompt (include the full path). For example:

start C:\Users\sarra\Desktop\Project2_kls.sql

  • You will see all of the statements and output scroll by. When it is finished, the SQL prompt will appear again.
  • To disconnect from the database and close your session, type the following:

exit

  • Ensure that all your statements and related output appear correctly in the spooled text file.
  • If you have mistakes, you can make the necessary corrections to the SQL statements in your notepad file. Note: If your SQL file contains Create Table statements, you will need to drop the previously-created tables before running the SQL file again. You can do this at the SQL prompt, or you can add the Drop Table statements to the beginning of the SQL file before you run it (the latter is the better option)./li>

Source Code

tables /** * A node that is used to build a linked list. * * @author Hp Envy */ public class Node { /** * Node value */ int value; /** * Reference to the next node */ Node next; /** * Reference to the previous node */ Node previous; /** * Create a node. * * @param newValue Value to be stored in the node. */ public Node(int newValue) { value = newValue; next = null; } }

DOUBLY LINKED LIST

/** * A doubly linked list. A linked list whose tables have a next and previous * node. * * @author Hp Envy */ public class DoublyLinkedList { /** * Reference to the head node */ private Node head; /** * Reference to the tail node */ private Node tail; /** * Add a new node at the end of the list * * @param newValue */ public void insert(int newValue) { Node newNode = new Node(newValue); if (isEmpty()) { // Case if empty head = newNode; tail = newNode; } else { // Add next to tail tail.next = newNode; newNode.previous = tail; tail = newNode; } } /** * Delete the element that holds the key. * * @param key Target element to deletes */ public void delete(int key) { Node currentNode = head; while (currentNode != null) { if (currentNode.value == key) { // Found it.. do delete if (currentNode == head) { // Case deleting the head head = currentNode.next; if (head != null) { head.previous = null; } else { tail = null; } } else if (currentNode == tail) { // Case deleting the tail tail = tail.previous; if (tail != null) { tail.next = null; } else { head = null; } } else { // Case deleting in-between currentNode.previous.next = currentNode.next; currentNode.next.previous = currentNode.previous; } return; } currentNode = currentNode.next; } } /** * Return the value of a node. * * @param index Target node * @return Node value */ public int get(int index) { if (index < 0) { throw new RuntimeException("Index out of bounds."); } Node currentNode = head; for (int i = 0; i < index && currentNode != null; i++) { currentNode = currentNode.next; } if (currentNode == null) { throw new RuntimeException("Index out of bounds."); } return currentNode.value; } /** * Update the value of a node. * * @param index Target node * @param value Updated value */ public void set(int index, int value) { if (index < 0) { throw new RuntimeException("Index out of bounds."); } Node currentNode = head; for (int i = 0; i < index && currentNode != null; i++) { currentNode = currentNode.next; } if (currentNode == null) { throw new RuntimeException("Index out of bounds."); } currentNode.value = value; } /** * Check if list is empty. * * @return True if empty, otherwise false. */ public boolean isEmpty() { return head == null; } /** * Return the content of the list * * @return Content of list */ @Override public String toString() { String result = ""; Node currentNode = head; while (currentNode != null) { result += currentNode.value; if (currentNode.next != null) { result += ", "; } currentNode = currentNode.next; } return result; } /** * Return the content of the list in reverse * * @return Content of list in revere */ public String toStringReverse() { String result = ""; Node currentNode = tail; while (currentNode != null) { result += currentNode.value; if (currentNode.previous != null) { result += ", "; } currentNode = currentNode.previous; } return result; } }// end class

Similar Samples

Explore our curated samples showcasing expertly crafted solutions across various programming languages. At ProgrammingHomeworkHelp.com, our samples exemplify thorough understanding and proficiency in tackling programming assignments. Whether it’s algorithm design, data structures, or application development, our samples demonstrate our commitment to delivering top-notch programming homework help tailored to your academic needs