If you need to develop a website with dynamic content, you must use the database. Although modern websites are inseparable from databases, many developers still know little about their working principles.
PHP supports many types of databases. PHP authentication is only related to PHP capabilities. Therefore, the topics in this chapter are not specific to a specific database management system. In addition, most commercial DBMS, such as MySQL AB, have their own certification courses.
This chapter describes your knowledge about database principles and programming, regardless of the specific DBMS.
Problem
1. Consider the following SQL statement. Which option can limit the number of returned records? (Double choice)
SELECT * FROM MY_TABLE
A. If possible, convert the query to A storage routine.
B. If the program permits, specify the range of returned records for the query.
C. If possible, add the where Condition
D. Convert the query into a view if the DBMS permits
E. Use prepared statements if DBMS permits
2. Which of the following conditions can be added to filter the returned dataset?
Answer :____________
3. What is inner join used?
A. Associate two tables into A persistent table using the same field
B. Create a result set based on the same rows in the two tables
C. Create a dataset based on the records in a table
D. Create a result set that contains the same records in two tables and all records in one table
E. None of the above
4. Which of the following DBMS does not have a PHP extension library?
A. MySQL
B. IBM DB/2
C. PostgreSQL
D. Microsoft SQL Server
E. None of the above
5. Consider the following script. If the mysql_query function sends an unfiltered query statement to an opened database connection, which of the following options is correct? (Double choice)
The following is a code snippet:
<? Php
Rows $ r = mysql_query (delete from mytable where id =. Rows $ _ GET [ID]);
?>
A. the number of records in MYTABLE exceeds 1
B. user input data needs to be properly transcoded and filtered
C. Call this function to generate a record containing the number of other records
D. Passing ID = 0 + OR + 1 to the URL will delete all tables in MYTABLE.
E. The query statement should contain the database name.
6. The ______ statement can be used to add new records to an existing table.
Answer :____________
7. Which of the following statements is true?
A. Using indexes can speed up data insertion.
B. Good indexing policies help prevent cross-site attacks
C. Indexes should be designed based on the actual application of the database.
D. Deleting a record will cause the index of the entire table to be damaged.
E. Only numeric record rows need to be indexed
8. can join be nested?
A. Yes
B. No
9. Consider the following data tables and queries. How can I add indexes to increase the query speed?
Create table mytable (
Id int,
Name varchar (100 ),
ADDRESS1 VARCHAR (100 ),
ADDRESS2 VARCHAR (100 ),
Zipcode varchar (10 ),
City varchar (50 ),
Province varchar (2)
)
Select id, VARCHAR
FROM MYTABLE
Where id between 0 & 100
Order by name, ZIPCODE
A. Add an index to the ID
B. Add an index for NAME and ADDRESS1
C. Add an index to the ID, and then add an index to the NAME and ZIPCODE respectively.
D. Add an index for ZIPCODE and NAME
E. Add full-text search for ZIPCODE