Question: Objective #1 Write a Basic Select Query for Reporting Purposes In this objective, write a basic select query to get (read) records from the cloud

Objective #1 Write a Basic Select Query for Reporting Purposes

In this objective, write a basic select query to get (read) records from the cloud database table using the Azure phpMyAdmin web client. By now, you should already know how to login to the phpMyAdmin web client. Once you logged in, select your database table and click on the SQL menu option at the top. This will give you a developer window that can process SQL commands against the table you clicked on. Modify the Select query statement in the developer window, so it returns specific column names and separate each column with a comma "," and make sure you write the from statement which selects a specific table (the square brackets represent a placeholder, do not use them in your actual SQL statement) then press the Go button.

Sample of Displaying Multiple Columns to the Screen:

Select Column1, Column2, Column3

From [tablename]

Objective #2 Write an SQL Query with a Filter

Use this objective to write another SQL statement and expand the previous select statement. Apply a filter to the select statement by adding a where clause. The Where clause lets you return specific records that you need to read which filters out all other records.

Sample of a Where Clause Filter:

Select Column1, Column2, Column3

From [tablename]

Where Column1 = 1

Objective #3 Write an SQL Query with Wildcards

In this objective you will update the existing SQL statement and implement a wildcard to filter and search for specific criteria. The wildcard are special characters that the MySQL server will recognize as a keyword to search through the data and look for matching query details. There are two types of wildcards, one can be applied in the select clause and other is applied in the where clause. The where clause wildcard uses the "%" and you can do specific searches either left or right of the string searching criteria. Modify your SQL query with a wildcard in the where clause statement.

Sample of a Select Wildcard Select * From [tablename]

Sample of a Where Clause Wildcard Select Column1, Column2, Column3 From [tablename] Where Column1 LIKE '%Rass%'

code listed below:

school

blank

Fill in your name and telephone, then click Submit to register.

FIRST_NAME
LAST_NAME
TELEPHONE

// Connect to Database. try { $conn = new PDO("mysql:host=$host;dbname=$db", $user, $pwd); //$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch (Exception $e) { die(var_dump($e)); }

//Following the database connection code, add code for inserting registration information into the database. if (!empty($_POST)) { try { $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $telephone = $_POST['telephone']; // Insert data $sql_insert = "INSERT INTO tblcda3315c(FIRST_NAME, LAST_NAME, TELEPHONE) VALUES (?,?,?)"; $stmt = $conn->prepare($sql_insert); $stmt->bindValue(1, $first_name); $stmt->bindValue(2, $last_name); $stmt->bindValue(3, $telephone); $stmt->execute(); } catch (Exception $e) { die(var_dump($e)); } echo '

You're Registered!

'; }

//Finally, following the code above, add code for retrieving data from the database. $sql_select = " SELECT * FROM tblcda3315c "; $stmt = $conn->query($sql_select); $registrants = $stmt->fetchAll(); if (count($registrants) > 0) { echo "

People Who Are Registered:

"; echo ""; echo ""; echo ""; echo ""; foreach ($registrants as $registrant) { echo ""; echo ""; echo ""; } echo "
FIRST_NAMELAST_NAMETELEPHONE
{$registrant['FIRST_NAME']}" . $registrant['LAST_NAME'] . "" . $registrant['TELEPHONE'] . "
"; } else { echo "

No one is currently registered.

"; } ?>

This is a block paragraph #2

This is a block paragraph #3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!