IST 210 Final
In SQL, a query can be all of the following except: a) Select b) Join c) Update d) Insert
B
Which of the following isn't a purpose of a join? a. A succinct form of writing a subquery b. An easier way of making a transaction table in the database c. Merging two, or more, tables together for information displays d. Creating a list that can include null values
B
In a PHP page, Bob writes the following line: $query = SELECT * FROM CUSTOMER; When Bob loads the page in his browser, however, he is greeted by a confusing error instead of a table with the contents of his CUSTOMER table. What can Bob do to fix this error?
Bob forgot to put quotes around his query. The PHP line should look like this: $query = "SELECT * FROM CUSTOMER";
Where will an SQL 'injection' take place within the written SQL
It will take place in the middle of a select statement
What is the difference between the DROP and DELETE commands?
The DROP command completely removes a table and all of its data from a database. The DELETE command only removes data, but keeps the structure of the table.
What is HTML used for?
Used to display any information visually in a web browser
What are the four components of a database system?
Users, Database Application, Database Management System, Database
What does an outer join do?
We can specify if we want to show additional information from either table in a relation.
How would one write the same SELECT statement in PHP, and store it as a PHP variable.
$query = "SELECT * FROM STUDENT"
What is a Join in SQL?
A Join is a method used to merge two or more tables to display information from one or more tables.
XML was developed in the early a) 70's b) 80's c) 90's d) 00's
C
What is the purpose of a join?
To merge two tables
What are some advantages of XML compare to Rational Database?
easier and more flexible to structure, easier to modify information, greater system interoperability
How do you start a section of PHP code?
<?php
Write the following SQL into XML format: Customer(CustID, OrderNum, CustName, CustNum) INSERT INTO Customer VALUES(9, 27, 'Alan Turing', '717-381-3859')
<CustomerList> <Customer id = "9"> <OrderNum idref = "27"> <CustName>Alan Turing</CustName> <CustNum>717-381-3859</CustNum> </Customer> </CustomerList>
Which tag is necessary to begin any HTML document?
<HTML>
How would you link to http://www.youtube.com using HTML?
<a href=http://ww.youtube.com</a>
What is the HTML tag for opening and closing bold font?
<b> </b>
What is an example of an HTML image tag?
<img src= "lizard.jpg">
Choose the correct formatting for an XML document. a) <subject>...<location>...<date>...</date>...</location>...</subject> b) <subject>...</date>...<date>...<location>...</subject>...</location> c) </subject>...</location>...</date>...<date>...<location>...<subject> d) </subject>...<date>...<subject>...</location>...<location>...</date>
A
Which of the following is not a main feature of XML? a.) Fixed set of tags b.) An agreed upon set of tags can be used in many applications c.) XML has the concept of a schema d.) XML is a data model
A
What is the difference between a surrogate key and a primary key?
A primary key is a candidate key chosen to be the main key for the relation. A surrogate key is a unique, numeric value that is added to a relation to serve as the primary key.
What is PHP? a.)The programming language of HTML and the web. It programs the behavior of webpages and allows for dynamic content b.) Used to "describe" the look and feel of a webpage. Defines the design of the webpage c.) Code which operates on a server backend in conjunction with a webpage to display dynamic content d.) Used to display any information visually in a web browser
C
Give an SQL CREATE TABLE statement based on this XML structure: <employees> <person> <empID> 1 </empID> <name> Lily Smith</name> <phone> 214-658-4632 </phone> <email> [email protected] </email> </person> <person> <empID> 2 </empID> <name> Derek Lynn</name> <tel> 564-642-5774 </tel> <email>[email protected]</email> </person> </employees>
CREATE TABLE EMPLOYEES ( EmpID Name Email Phone ); Integer char(50) char(100) char(50) PRIMARY KEY, NOT NULL, NOT NULL, NOT NULL
What are the four Data Definition statements?
CREATE, ALTER, DROP, TRUNCATE
The ability to inject SQL commands into a database through existing applications is called ___________? A. Database Hacking B. SQL Hacking C. PHP Injection D. SQL Injection
D
Which of the following are part of DDL (Data Definition Language)? a) CREATE b) ALTER c) DROP d) TRUNCATE e) All of the above
E
Which of the following are part of DML (Data Manipulation Language)? a) INSERT b) SELECT c) UPDATE d) DELETE e) All of the above
E
What does the command "echo?" mean?
Echo is a means of outputting text to the webpage
What does XML language stand for?
Extensible Markup Language
True or False: When using JavaScript, you must classify each data entry as if you were using SQL (int, char).
False: JavaScript is a typeless language
What is the difference between HTML and XML?
HTML is based upon certain pre-determined standards meanwhile XML is a much more flexible way to code and is more customizable. HTML is used to display data while XML is for representing data.
What are the names of the two parts often referred to as making up an HTML document and what type of things belong in each?
Head, for operations and code, and body, for text, images etc.
What does HTML stand for?
Hypertext Markup Language
What does PHP stand for?
Hypertext Preprocessor
How do you represent text in HTML?
In double quotes "text"
How do you represent text in SQL?
In single quotes 'text'
Name one difference between HTML and XML.
Information presentation vs. data "storage" language, pre-defined tags vs. no pre-defined tags, displays information on an interactive page (like a website) vs. stores data similarly to a database
What is the best way to protect SQL databases and programming languages against SQL injections?
Input Validation
How and where is metadata stored?
Meta data must be stored in the data base like all other data.
What is wrong with the following XML document: <customerlist> <Customer ID="1"> <CustomerName>Alex Miles<CustomerName> <CustomerEmail>[email protected]</CustomerEmail> </customerlist>
Missing </customer> tag
What is PHP used for?
PHP is a coding language that is use for server-side web development which runs on a web server.
Why can't we see PHP code in a loaded web page?
PHP is a server side programming language. Therefore, the PHP code is executed on the server and is not visible by the client. However, you can have PHP output HTML code using an echo statement.
Given the following subquery below, write a between statement to display salaries between 10-300: SELECT EmpName FROM Employee WHERE Salary = 100;
SELCT EmpName FROM Employee WHERE Salary BETWEEN 10 AND 300;
Write a SELECT statement to view all of the data in the STUDENT table.
SELECT * FROM STUDENT;
Write the following subquery as a join: SELECT AdviserName FROM ADVISER WHERE StudentID IN (SELECT StudentID FROM STUDENT WHERE Major = 'Economics');
SELECT ADVISER.AdviserName FROM ADVISER.STUDENT WHERE ADVISER.StudentID = STUDENT.StudentID AND STUDENT.Major = 'Economics';
Write a SELECT statement for selecting students who are coached by James Franklin.
SELECT ATHLETE.AthleteLastName, ATHLETE.AthleteFirstName, ATHLETE.CoachLastName, FROM ATHLETE, COACH WHERE ATHLETE.CoachLastName='FRANKLIN';
Write a JOIN between the tables STUDENT and MAJOR, selecting StudentName from a STUDENT table where the shared variable is called 'MajorID', and the desired condition is where 'MajorName' matches 'IST'.
SELECT StudentName FROM Student AS S JOIN MAJOR AS M ON S.MajorID = M.MajorID WHERE M.MajorName = 'IST';
Write out the template for a subquery.
SELECT {something}FROM {a table} WHERE AttrName {must be a foreign key} IN ( SELECT AttrNameFROM {table where AttrName is the Primary Key}WHERE {what you're looking for here} );
What is SQL injection?
SQL injection is the ability to insert SQL Commands into a database through existing applications
What is SQL and what does it stand for?
SQL is a data sublanguage that is used to create database structures. SQL stands for Structured Query Language.
What is the difference between a join statement and a subquery?
Subqueries can only display data from one table, joins, can display information from multiple tables.
Javascript is debatably the best programming language (T/F).
TRUE
True/False: You can operate HTML code within PHP code
TRUE
You can insert rows with NULL values in a table. (TRUE / FALSE)
TRUE
Within a PHP database connection code the headings UID and PWD refer to.
The UID is your username and PWD refers to the password for it
What does the wildcard character "*" mean in a SELECT statement?
The asterisk is used to show all of the column values that match the specified criteria.
What is wrong with the following PHP statement: <html> <body> $query = "SELECT * FROM PEOPLE"; </html>
There is no close to the body you need to add </body> after the query statement
What SQL statement deletes the contents of a table but allows it to keep its structure?
Truncate
What do the following terms stand for? XML HTML CSS JS PHP
XML - Extensive Markup Language HTML - Hypertext Markup Language CSS - Cascading Style Sheets JS - JavaScript PHP - Hypertext Preprocessor
What are two core differences between XML and HTML?
XML is more flexible, HTML has a set standard
What is the purpose of XML?
XML is used in order to describe, represent and materialize database views.
What is the difference between XML and HTML?
XML is used to store data, while HTML is used to present data.