CIS 2336 Test 3: PHP, SQL, XML

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

With SQL, how can you return the number of records in the "Persons" table?

SELECT COUNT(*) FROM Persons

Which SQL statement is used to return only different values?

SELECT DISTINCT

What is the MySQL command for displaying all of the information in this table?

SHOW Customers

What does SQL stand for?

Structured Query Language

In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

True

PHP allows you to send emails directly from a script

True

PHP can be run on Microsoft Windows IIS(Internet Information Server):

True

The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true

True

Which SQL statement is used to update data in a database?

UPDATE

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

What is the major difference between variable names in PHP and variable names in Javascript?

You dont really have to declare a variable in PHP

What is the MySQL command for creating a database? Can you always expect this command to work on any system?

CREATE DATABASE name; Yes, if you have the right permissions.

What MySQL command would you used to create a table called Customers with the following five fields: a unique identification number, first name, last name, telephone number and e-mail address?

CREATE TABLE 'my_business' . 'Customers' ( 'customer_id' INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 'customer_first_name' VARCHAR(10) NOT NULL, 'customer_last_name' VARCHAR(10) NOT NULL, 'telephone_number' VARCHAR(20) NOT NULL, 'email_address' VARCHAR(60) NOT NULL, ) ENGINE = MyISAM;

Which SQL statement is used to delete data from a database?

DELETE

With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

DELETE FROM Persons WHERE FirstName = 'Peter'

Give a typical command for inserting a record in the table created in the previous exercise.

INSERT INTO 'Customers'

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName) VALUES ('Olsen')

If you wanted to import a lot if data into this table from an external file, what would a typical line in that file look like?

It would just contain all of the data in single parenthesis .

What is a third normal form?

Non-key attributes cannot facts about other non-key attributes.

Which SQL keyword is used to sort the result-set?

ORDER BY

What is the major difference between how Javascript is used and how PHP is used in web programming? Where they are used.

PHP is a server side programming language, which is ran into the web server when a page is generated, before being sent to the browser. Javascript is a client side scripting language, that run into the browser, and is allowed to interact with the element that are present into the page.

What is the command for displaying just the names of the customers in the table?

SELECT * FROM Customers ORDER BY customer_first_name,customer_last_name;

With SQL, how do you select all the columns from a table named "Persons"?

SELECT * FROM Persons

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

SELECT * FROM Persons ORDER BY FirstName DESC

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

SELECT * FROM Persons WHERE FirstName='Peter'

What is a correct way to add a comment in PHP?

/*...*/

All variables in PHP start with which symbol?

$

How do you get information from a form that is submitted using the "get" method?

$_GET[];

What is the correct way to add 1 to the $count variable?

$count++;

Which one of these variables has an illegal name?

$my-Var

What is the correct way to end a PHP statement?

;

What are the opening and closing delimiters for a php script?

<?php ?>

What is the correct way to include the file "time.inc" ?

<?php include "time.inc"; ?>

PHP server scripts are surrounded by delimiters, which?

<?php...?>

What is a second normal form?

Deals with having the each non-key attribute to be information pertaining to the primary key.

What is a first normal form?

Deals with the shape of the record type. Each row of the table must have the same number of columns. Each value must be atomic.

What are three reasons why storing large amounts of data in "ordinary" files turned out not to be a good idea?

Duplication of files makes it hard to make sure if the data is up to date or not. It also takes up a lot of space. Another reason is maintenance of the data would be hard to keep up with with so many individual files. The last reason is simple human error which is very likely with so much individual editing.

Include files must have the file extension ".inc"

False

When using the POST method, variables are displayed in the URL:

False

The PHP syntax is most similar to:

Perl and C

Which SQL statement is used to extract data from a database?

SELECT

What is the MySQL command that says you are going to use a database called my_business?

CREATE TABLE 'my_business' . 'Table' (

Which SQL statement is used to insert new data in a database?

INSERT INTO

What would you say to a business owner who had decided to keep all of the data for his business in one large table?

Having your information on one large spreadsheet would be a bad idea because it would be really hard to go back later into your information and manipulate it to do things you want it to do.

With SQL, how can you insert a new record into the "Persons" table?

INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

What is the difference between the case-sensitivity of PHP and that of javascript?

PHP just the variables are case sensitive, javascript is all case sensitive

What does PHP stand for?

PHP: Hypertext Preprocessor

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

With SQL, how do you select a column named "FirstName" from a table named "Persons

SELECT FirstName FROM Persons

What is the PHP function you need to use to connect to MySQL from a PHP script, and what are its parameters?

Use the built in mysql_connect() function. The parameters are $db_location (the location of the MySQL server), $db_username (the user's MySQL username), and $db_password (the user's password).

How do you write "Hello World" in PHP

echo "Hello World";

What is the correct way to open the file "time.txt" as readable?

fopen("time.txt","r");

What is the correct way to create a function in PHP?

function myFunction()

What happens in a testing environment when your PHP script contains a syntax error?

it will come up with a fatal error. Fatal error: Call undefined function datf() in welcome.php on line 12.

Once your PHP script has connected to MySQL, what is the PHP function you need to use to choose a database for subsequent queries, and what are its parameters.

mysql_select_db()

What is the correct way to connect to a MySQL database?

mysqli_connect(host,username,password,dbname);

In PHP, the die() and exit() functions do the exact same thing.

true


Set pelajaran terkait

American RedCross ACV First Aid/CPR/AED Course

View Set

ATI Respiratory Learning System Med-Surg

View Set

Accounting chapter 11 Part A: depreciation, depletion and amortization and B

View Set