Read this before starting!

Similar documents
Read this before starting!

Read this before starting!

Section 001. Read this before starting!

Read this before starting!

Read this before starting!

Section 001. Read this before starting! You may use one sheet of scrap paper that you will turn in with your test.

Read this before starting!

Read this before starting!

Read this before starting!

Read this before starting!

Read this before starting!

If a b or a c, then a bc If a b and b c, then a c Every positive integer n > 1 can be written uniquely as n = p 1 k1 p 2 k2 p 3 k3 p 4 k4 p s

East Tennessee State University Department of Computer and Information Sciences CSCI 1710/Section 001 Web Design I TEST 1 for Fall Semester, 2000

Read this before starting!

East Tennessee State University Department of Computer and Information Sciences CSCI 4717 Computer Architecture TEST 3 for Fall Semester, 2006

Read this before starting!

East Tennessee State University Department of Computer and Information Sciences CSCI 4717 Computer Architecture TEST 2 for Fall Semester, 2007

Read this before starting!

Read this before starting!

Read this before starting!

Section 001 & 002. Read this before starting!

Section 001. Read this before starting!

Section 002. Read this before starting!

East Tennessee State University Department of Computer and Information Sciences CSCI 4717 Computer Architecture TEST 3 for Fall Semester, 2005

Section 001. Read this before starting!

MySQL Creating a Database Lecture 3

Simple Quesries in SQL & Table Creation and Data Manipulation

Review. Objec,ves. Example Students Table. Database Overview 3/8/17. PostgreSQL DB Elas,csearch. Databases

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Today s Goals. CSCI 2910 Client/Server-Side Programming. More on Querying Records. Conditions. Conditions (continued) Conditions (continued)

WAYLAND BAPTIST UNIVERSITY VIRTUAL CAMPUS SCHOOL OF BUSINESS SYLLABUS

ITEC 3335 Database Development Fall 2018 Final Examination. Last Name: First Name: Student Id:

CS 327E Lecture 2. Shirley Cohen. January 27, 2016

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia

Unit 27 Web Server Scripting Extended Diploma in ICT

LAB 4.1 Relational Operators and the if Statement

CSCI Design of Database Systems Spring 2018 Final Examination. Last Name: First Name: Student Id:

Relational Algebra and SQL

Access Intermediate

Syllabus for HPE 451 Directed Study 1-3 Credit Hours Spring 2014

Networks and Web for Health Informatics (HINF 6220)

Lecture 07. Spring 2018 Borough of Manhattan Community College

CSCI 4000 Assignment 4

MyELT STUDENT QUICK START GUIDE

11 Data Structures Foundations of Computer Science Cengage Learning

SQL Data Definition and Data Manipulation Languages (DDL and DML)

Unit 1 - Chapter 4,5

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018

EE221 Databases Practicals Manual

COMP 1130 Programming Fundamentals (Javascript Rocks)

Syllabus for HPE 099 Aerobic Proficiency 1 Credit Hour Spring 2015

CSC Web Programming. Introduction to SQL

MIS2502: Review for Exam 1. Jing Gong

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation

Fall 2018 CSE 482 Big Data Analysis: Exam 1 Total: 36 (+3 bonus points)

CMPT 354: Database System I. Lecture 3. SQL Basics

Syllabus for HPE 120 Dance Aerobic Proficiency 0.0 Credit Hour Spring 2012

How to use SQL to create a database

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

ASSIGNMENT NO 2. Objectives: To understand and demonstrate DDL statements on various SQL objects

The M in LAMP: MySQL CSCI 470: Web Science Keith Vertanen Copyright 2014

30. Structured Query Language (SQL)

COWLEY COLLEGE & Area Vocational Technical School

Syllabus for CSC 455 Database Systems 3 Credit Hours Spring 2012

Module 3 MySQL Database. Database Management System

COMP 244 DATABASE CONCEPTS & APPLICATIONS

Syllabus for HPE 099 Aerobic Proficiency 1 Credit Hour Fall 2012

BraindumpsVCE. Best vce braindumps-exam vce pdf free download

CSCI 434 INTRODUCTION TO LOCAL AREA NETWORKS (SPRING 2015)

CSC 453 Database Technologies. Tanu Malik DePaul University

Exact Numeric Data Types

SQL Retrieving Data from Multiple Tables

chapter 2 G ETTING I NFORMATION FROM A TABLE

IT360: Applied Database Systems. SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) SQL: Data Definition Language

Introduction to relational databases and MySQL

South Portland, Maine Computer Information Security

INFORMATION TECHNOLOGY NOTES

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL

Updated: 2/14/2017 Page 1 of 6

SQL: Structured Query Language Nested Queries

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

CISN 340 Data Communication and Networking Fundamentals Fall 2012 (Hybrid)

RESTRICTING AND SORTING DATA

Basic SQL. Basic SQL. Basic SQL

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

MWF 9:00-9:50AM & 12:00-12:50PM (ET)

Student handbook. SchoolS Program Success For Every Student. Seckman High School 2800 Seckman Road Imperial, MO 63052

QQ Group

The SQL data-definition language (DDL) allows defining :

Simple SQL. Peter Y. Wu. Dept of Computer and Information Systems Robert Morris University

COWLEY COLLEGE & Area Vocational Technical School

CENTRAL TEXAS COLLEGE ITCC 1440 CCNA 2: Routing and Switching Essentials. Semester Hours Credit: 4

Database Management Systems by Hanh Pham GOALS

UBC Graduate Information System (GIS)

Duration: 90 minutes. Page 1 of 14 Q2: /13 Q3: /13 TOTAL: /38. Bonus /1

Chapter 3 Introduction to relational databases and MySQL

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version :

Chapter-14 SQL COMMANDS

Creating a Relational Database Using Microsoft SQL Code. Farrokh Alemi, Ph.D.

Transcription:

Points missed: Student's Name: Total score: /50 points East Tennessee State University Department of Computer and Information Sciences CSCI 2910 (Tarnoff) Server/Client Side Programming TEST 2 for Spring Semester, 2007 Read this before starting! The total possible score for this test is 50 points. This test is closed book and closed notes. A summary of MySQL commands can be found at the bottom of this page. Please turn off all cell phones & pagers during the test. You may NOT use a calculator. Complex numeric calculations may be left in the form of an expression. All answers must be placed in space provided. Failure to do so will result in no credit for answer. If you perform written work on the back of a page in this test, indicate that you have done so in case the need arises for partial credit to be determined. Statement regarding academic misconduct from Section 5.7 of the East Tennessee State University Faculty Handbook, June 1, 2001: "Academic misconduct will be subject to disciplinary action. Any act of dishonesty in academic work constitutes academic misconduct. This includes plagiarism, the changing of falsifying of any academic documents or materials, cheating, and the giving or receiving of unauthorized aid in tests, examinations, or other assigned school work. Penalties for academic misconduct will vary with the seriousness of the offense and may include, but are not limited to: a grade of 'F' on the work in question, a grade of 'F' of the course, reprimand, probation, suspension, and expulsion. For a second academic offense the penalty is permanent expulsion." SQL/MySQL Syntax: INSERT INTO tablename (fieldname [, fieldnames]) VALUES (value [, values]) DELETE FROM tablename WHERE fieldname=value UPDATE tablename SET fieldname=value WHERE fieldname=value USE database SHOW TABLES CREATE TABLE tablename (field1 data_type [NULL/NOT NULL], field2 data_type [NULL/NOT NULL],...) DROP TABLE tablename SELECT [ ALL DISTINCT] * COLUMN1[, COLUMN2 ] FROM TABLE1 [, TABLE2 ] WHERE [CONDITION1 EXPRESSION1][ AND OR CONDITION2 EXPRESSION2 ] ORDER BY fieldname [, fieldnames] [ASC DESC] LIMIT [start,] size

All problems on this test refer to the three tables shown below that are part of a relational database. common keys Table name: enrolled_students last_name first_name student_id user_id major_id Smith Janet 11443985 zjas999 3 Lawrence Bill 11654698 zbhl888 2 Walker James 11560795 zjew777 1 Thomas Paul 11778843 zpat666 5 Jones Martha 11011034 zmtj555 1 Harriet Debbie 11900023 zdhh444 6 common keys Table name: majors Table name: gradebook id char_code student_id T1 T2 T3 1 CSCI 11011034 98 82 90 2 MGMT 11560795 78 88 86 3 ENTC 11443985 62 91 86 4 PHYS 11654698 68 69 71 5 ENGL 11778843 93 91 88 6 HIST 11900023 79 83 81 Here are some additional comments about the above table. First, the tables are only partial tables. Assume there is more data. Second, enrolled_students and gradebook could probably have been the same table, but they were kept separate for reasons of security, i.e., not wanting people who had access to the roll also have access to the gradebook. Third, the table majors could be made unnecessary by simply using the char_code directly for the major_id in enrolled_students. The problem with that is that if a char_code gets changed, you would have to go through all of the enrolled students and manually make the change instead of making the change in one place, i.e., the majors table. 1. What score did Martha Jones get on Test 2 (T2)? (2 points) From the enrolled_students table, we see that Martha Jones' student_id is, 11011034. Using this student_id, we see that her grades in the gradebook table are in the first row. For T2, she received an 82. 2. Which field would serve best as the primary key for the enrolled_students table? (Note that there are actually 2 answers, but one is better than the other.) (2 points) Both student_id and user_id are unique fields for all users. Since the majority of references to this table and others in the database will be through the student_id, it is probably a better choice for the primary key. 3. Which field(s) would serve best as the primary key for the gradebook table? (2 points) The only unique field in the gradebook table is student_id. 4. If we wanted to add a field to identify the student's level, i.e., freshman, sophomore, junior, or senior, which table should we use? (2 points) The only table that identifies students information is the enrolled_students table. There isn't any student information in majors, and it is highly unlikely that all students would be listed in gradebook. a.) enrolled_students b.) majors c.) gradebook d.) need to add a fourth table

5. If we wanted to add a field to identify properties of the class such as instructor name, meeting time, or assigned room, which table should we use? (2 points) There is no table representing course information. The closest is gradebook, but that table should only contain a list of the students associated with that class and their corresponding grades. A new table should be added to hold course information. a.) enrolled_students b.) majors c.) gradebook d.) need to add a fourth table 6. What SQL data type would you assign to the field id in the table majors? Be as specific as you can. There will never be more than 256 majors. (2 points) The clue was that there will never be more than 256 majors. Therefore, an integer from 0 to 255 would be sufficient to uniquely identify different majors. This means a TINYINT will be the best type. a.) BIT b.) TINYINT c.) INTEGER c.) BIGINT d.) FLOAT e.) DATE f.) DATETIME g.) YEAR h.) CHAR i.) VARCHAR j.) TEXT k.) ENUM 7. What SQL data type would you assign to the field char_code in the table majors? Be as specific as you can. This field will always have exactly 4 characters. (2 points) The clue was that there will always be exactly 4 characters. This means a CHAR(4) will be the best type. a.) BIT b.) TINYINT c.) INTEGER c.) BIGINT d.) FLOAT e.) DATE f.) DATETIME g.) YEAR h.) CHAR i.) VARCHAR j.) TEXT k.) ENUM 8. Write the SQL statement to create the table majors. (3 points) CREATE TABLE majors (id TINYINT, char_code CHAR(4)); Note that even if you got the wrong answers in 6 and 7, the data types you used to answer this question must match what you answered for problems 6 and 7. 9. Complete the partial MySQL select statement below in order to display all fields from all records contained in the table enrolled_students sorted by last_name then by first_name. (3 points) select * from enrolled_students order by last_name, first_name; 10. Complete the partial MySQL select statement below in order to display all fields from records 2, 3, and 4 of the table enrolled_students. (Note that the record numbers identifies the position of the record within the table, the first record being position 0.) (3 points) select * from enrolled_students limit 2, 3; 11. Complete the partial MySQL select statement below in order to display all fields of the single record contained in enrolled_students with a user_id equal to "zmtj555". (3 points) select * from enrolled_students where user_id="zmtj555";

12. Complete the partial MySQL select statement below in order to display all fields of records contained in enrolled_students with a student_id containing '10' as the second and third digit. (3 points) select * from enrolled_students where student_id like '_10%; 13. Complete the partial MySQL select statement below in order to join the tables enrolled_students and gradebook to display the students' names and their corresponding test grades. (4 points) select last_name, first_name, T1, T2, T3 from enrolled_students, gradebook where enrolled_students.student_id = gradebook.student_id; 14. Write the SQL statement to output the student_id and the result of the final grade calculation (T1*0.4)+(T2*0.2)+(T3*0.4) from the table gradebook. (4 points) select student_id, ((T1*0.4)+(T2*0.2)+(T3*0.4)) from gradebook; 15. In the space below, write the output from the following MySQL statement: (2 points) select student_id from gradebook where T1 > 80; student_id 11011034 11778843 16. In the space below, write the output from the following MySQL statement: (3 points) select student_id, T1+5 from gradebook where T1 between 70 and 80; ------+ student_id T1+5 ------+ 11560795 83 11900023 84 ------+ 17. Identify all three syntax errors in the MySQL command below. (3 points) Missing opening quotation marks. Underscore should be a period. select enrolled_students.last_name, enrolled_students.first_name, majors_char_code from enrolled_students, majors where (enrolled_students.majorid = majors.id) and (majors.char_code = CSCI"); Underscore missing.

18. The data type definition DECIMAL(10, 4): (2 points) a.) defines a decimal value between 4 and 10. b.) defines a ten digit base four value. c.) defines a four digit base ten decimal value. d.) defines a ten digit fixed point decimal value with 4 digits after decimal point. e.) is an illegal data type definition. 19. In the client/server side model, having a middle layer provides: (circle all that are true) (3 points) a.) ability to access more than one database with a single transaction b.) ability connect to many different types of data sources c.) ability to prioritize requests before they reach the data base d.) improved security