Section 1

Preview this deck

What command is used to make a new table in a database?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (40)

Section 1

(40 cards)

What command is used to make a new table in a database?

Front

CREATE TABLE

Back

What is a Primary Key? And what are three rules it must follow?

Front

Unique, Never Changes, Arbitrary

Back

Which SQL command allows you to read rows of data from a table?

Front

SELECT

Back

What are the three types of table relationships?

Front

One-to-One, One-to-Many, Many-to-Many

Back

Assuming you have the following php code to store the records returned from a database query, what is the correct way to access an individual value from that query? while ($row = mysqli_fetch_array($result)) { // what goes here? }

Front

print "<br />Some value: " . $row["somecolumn"] . "<br />";

Back

Describe the process of querying a database of how you should use them in PHP.

Front

Step 1 - mysqli_connect(), Step 2 - mysqli_query(), Step 3 - mysqli_fetch_array(), Step 4 - iterate over result $row with foreach or while loop, or otherwise process the data returned.

Back

mysqli_close()

Front

closes the MySQL connection. takes (database connection)

Back

A query language for interacting with database applications like MySQL

Front

SQL

Back

A MySQL database is divided into these

Front

Tables

Back

This SQL statement drops an entire table from the database, meaning that the table is removed along with any and all data stored within it.

Front

DROP TABLE tableName

Back

What SQL command inserts rows of data into a table?

Front

INSERT INTO

Back

mysqli_query()

Front

make a query to the MYSQL database. takes (connection information, query)

Back

Why shouldn't live sites show MySQL errors and the queries being run?

Front

SQL Injection

Back

What does a relational database use to relate the tables in a database to other tables.

Front

foreign keys

Back

True or false: Once you have opened a MySQL database connection in PHP, you can run multiple queries before closing the connection.

Front

True

Back

An application that lets you store data in databases and tables and insert and retrieve information using the SQL language.

Front

MySQL

Back

When using the DELETE statement, you usually need to include.

Front

a WHERE clause

Back

This SQL statement orders the results of a query based on a certain column of data. Use ASC or DESC after the statement to sort the data in ascending or descending order. ASC is the default order for ORDER BY, and is, therefore, optional.

Front

ORDER BY column

Back

Why is it preferable to store the mysqli_connect.php script outside of the Web root directory?

Front

Because the file contains DB credentials

Back

What does the LIMIT clause do?

Front

Limits the number of rows returned from a SELECT statement

Back

mysqli_connect()

Front

connect to the MySQL database. takes (database host, database user, database password, database name)

Back

INSERT statement template

Front

INSERT INTO table_name (column_name1, column_name2, ...) VALUES ('value1', 'value2', ...)

Back

How do you get all items from a table called "subjects" and in an ascending order based on a column called "position"?

Front

SELECT * FROM subjects ORDER BY position ASC

Back

Which SQL command updates a row of data that currently exists in a table?

Front

UPDATE tableName SET column=value;

Back

mysqli_connect_error()

Front

gives the error if there is a connection error. takes no arguments

Back

mysqli_error()

Front

gives the error (if any) for the mysqli_query(). takes (database connection)

Back

How many columns and what data is return by the follow: SELECT balance, number FROM accounts WHERE balance < 0

Front

The balance and number for all rows where balance is less than 0.

Back

If a row in one table is related to just one row in another table, the tables are said to have a:

Front

One-to-One relationship

Back

die()

Front

kills the attempted connection to MySQL if it does not connect properly. takes the error to display

Back

$query = "SELECT columnA, columnB FROM table WHERE columnC="foo"";

Front

$query = "SELECT columnA, columnB FROM table WHERE columnC=\"foo\""; OR $query = "SELECT columnA, columnB FROM table WHERE columnC='foo'";

Back

Why is it important to use the mysqli_real_escape_string( ) function?

Front

SQL Injection

Back

mysqli_fetch_array()

Front

gets the array of the results from the MySQL query. takes (results variable)

Back

How do you restrict which columns are returned by a query?

Front

List them in the column list

Back

This SQL clause is used in conjunction with other SQL commands to build statements that target specific rows in a table. For example, you can isolate rows that have a column matching a specific value.

Front

WHERE

Back

What types of values shouldn't be quoted?

Front

Numeric Values

Back

What types of values must be quoted in queries?

Front

Text Strings

Back

Use this SQL statement to delete rows from a table. Depending on how you use the statement, you can delete individual rows or multiple rows.

Front

DELETE FROM tableName

Back

What SQL command is used to make a new database?

Front

CREATE DATABASE

Back

A persistent, highly organized, data structure that is typically stored in a file on a hard drive.

Front

Database

Back

Write a Select Statement that retrieves all rows with a lastname of Willis lastname firstname city Bandler Sharon Tallahassee Willis Carl Tallahassee Zoro Ben Pensacola

Front

SELECT * FROM customer WHERE lastname="Willis"

Back