Table Employee Employee Rec # ID LastName FirstName City 1 10011 Lee Juan Seoul
ID: 3920249 • Letter: T
Question
Table Employee
Employee
Rec #
ID
LastName
FirstName
City
1
10011
Lee
Juan
Seoul
2
10012
Choi
Pedro
Quezon
3
10013
Ylagan
Maria
Seoul
4
10105
Zuleta
Juana
San Juan
1. Please refer to Table Employee. Using MySQL command, display all columns from table Employee.
SELECT FROM * Employee;
SELECT ALL FROM Employee;
SELECT Employee;
SELECT * FROM Employee;
2. Please refer to Table Employee. Using MySQL command, display all columns except for column city.
SELECT FROM * Employee;
SELECT city FROM Employee;
SELECT ID, LastName, FirstName FROM Employee;
SELECT (*) FROM Employee;
3. Please refer to Table Employee. Using MySQL command, display only the First Name and Last Name of all employee.
SELECT *, LastName, FirstName FROM Employee;
SELECT FirstName, LastName FROM Employee;
SELECT FirstNameLastName FROM Employee;
SELECT ONLY FirstName, LastName FROM Employee;
4. Please refer to Table Employee. Using MySQL command, display records of employee from Seoul.
SELECT * FROM Employee WHERE city=”Seoul”;
SELECT city=”Manila” FROM Employee;
SELECT FirstName FROM Employee WHERE Manila=”city”;
SELECT * FROM Employee city=”Manila”;
5. Please refer to Table Employee. Using MySQL command, change the last name of Maria to Enriquez.
CHANGE Employee “Maria Ylagan” SET “MariaEnriquez”;
UPDATE Employee SET “Ylagan” to “San Jose”;
UPDATE Employee SET LastName=”Enriquez” WHERE ID=”10013”;
UPDATE Employee SET “Enriquez” WHEREFirstName=”Maria”;
6. Please refer to Table Employee. Using MySQL command, add only this record: 10014, Lopez.
INSERT INTO Employee (ID, LastName) VALUES (10014, “Lopez”);
ADD COLUMN (ID, LastName) VALUES (10014, “Lopez”);
INSERT * INTO Employee (ID, LastName) VALUES (10014, “Lopez”);
ADD * INTO (ID, LastName) VALUES (10014, “Lopez”);
7. Please refer to Table Employee. Modify the record added in No. 70 by adding the employee’s first name to ‘Alejandro’ and city to ‘Cubao’
MODIFY REC 5 INSERT FirstName=”Alejandro” AND city=”Cubao”;
UPDATE SET FirstName=”Alejandro” AND city=”Cubao”;
UPDATE Employee SET FirstName=”Alejandro” AND city=”Cubao”;
UPDATE Employee SET FirstName=”Alejandro” AND city=”Cubao” WHERE ID=10014;
8. Please refer to Table Employee. Display all columns of the employees where id are above 10013.
SELECT ID FROM Employee WHERE ID > 10013;
SELECT * FROM Employee WHERE ID > 10013;
SELECT * FROM Employee ID > 10013 AND ID < 10015;
SELECT * FROM Employee WHERE ID = 10013;
9. Please refer to Table Employee. Display all columns of the employees except from employees came from Seoul:
SELECT * FROM Employee WHERE city=”Quezon” AND city=”San Juan”;
SELECT * FROM Employee WHERE city=”Quezon” AND “San Juan”;
SELECT * FROM Employee city=”Quezon, San Juan”;
SELECT * FROM Employee WHERE city=” Quezon, San Juan”;
10. Please refer to Table Employee. Display all the records of JuanaZuleta.
SELECT * FROM Employee of Juan Tolentino;
SELECT * FROM Employee;
SELECT FROM Employee WHERE = FirstName = “Juan Tolentino”;
SELECT * FROM Employee WHERE ID=”10105”;
11. The IP address associated to your answer in #8
10.22.14.7
172.0.0.1
192.168.1.1
202.0.0.1
Table Name: STUDENT
snum
sname
course
year
gender
bdate
200912345
Angus Maximus
Information Technology
3
M
1993-05-04
200912333
Prism Queen
Information Technology
3
F
1994-02-07
200820111
Ice Crown
Computer Science
4
F
1992-08-01
200811101
Valesti Knight
Information Technology
4
M
1992-06-08
201035600
Surge Seoul
Computer Science
2
M
1995-09-12
201055558
Dark Savior
Computer Engineering
0
1994-12-04
201165844
PyrusLyllwin
Computer Science
1
F
1995-10-10
What's the output of the codes below?
1.
$q = mysql_query("SELECT COUNT(year) FROM student");
$r = mysql_result($q,0);
-or-
$q = mysqli_query("SELECT COUNT(year) FROM student", $dbconnect);
$r = mysqli_result($q,0);
6
7
8
error
2.
What is the output of the code below?
$q = mysql_query("SELECT COUNT(gender) FROM student");
$r = mysql_result($q,0);
-or-
$q = mysql_query("SELECT COUNT(gender) FROM student");
$r = mysql_result($q,0);
6
7
8
error
3.
What is the output of the code below?
$q = mysql_query("SELECT COUNT(gender) FROM student WHERE gender='M'");
$r = mysql_affected_rows();
echo $r;
-or-
$q = mysqli_query("SELECT COUNT(gender) FROM student WHERE gender='M'", $dbconnect);
$r = mysqli_affected_rows();
echo $r;
4
3
2
1
4.
What is the output of the code below?
$q = mysql_query("SELECT COUNT(year) FROM student");
$r = mysql_num_rows($q);
-or-
$q = mysqli_query("SELECT COUNT(year) FROM student", $dbconnect);
$r = mysqli_num_rows($q);
6
7
8
error
5.
What is the output of the code below?
$q = mysql_query("SELECT DISTINCT(course) FROM student WHERE gender='F'");
$r = mysql_affected_rows();
echo $r;
-OR-
$q = mysqli_query("SELECT DISTINCT(course) FROM student WHERE gender='F'", $dbconnect);
$r = mysqli_affected_rows();
echo $r;
1
2
3
4
6.
What is the output of the code below?
$q = mysql_query("SELECT sname FROM student WHERE course='Computer Science' ORDER BY year");
$r = mysql_result($q,2);
echo $r;
-or-
$q = mysqli_query("SELECT sname FROM student WHERE course='Computer Science' ORDER BY year", $dbconnect);
$r = mysqli_result($q,2);
echo $r;
Prism Queen
Ice Crown
Surge Seoul
PyrusLyllwin
7.
What is the output of the code below?
$q = mysql_query("SELECT MAX(course) FROM student HAVING MAX(year)");
$r = mysql_result($q,0);
-or-
$q = mysqli_query("SELECT MAX(course) FROM student HAVING MAX(year)", $dbconnect);
$r = mysqli_result($q,0);
Computer Engineering
Computer Science
Information Technology
Error
Employee
Rec #
ID
LastName
FirstName
City
1
10011
Lee
Juan
Seoul
2
10012
Choi
Pedro
Quezon
3
10013
Ylagan
Maria
Seoul
4
10105
Zuleta
Juana
San Juan
Explanation / Answer
Query structure
SELECT: selects the rows and shows
* : all the columns
We have 2 types to show the table
1. Please refer to Table Employee. Using MySQL command, display all columns from table Employee.
SELECT * FROM Employee;
2. Please refer to Table Employee. Using MySQL command, display all columns except for column city.
SELECT ID, LastName, FirstName FROM Employee;
3. Please refer to Table Employee. Using MySQL command, display only the First Name and Last Name of all employee.
SELECT FirstName, LastName FROM Employee;
4. Please refer to Table Employee. Using MySQL command, display records of employee from Seoul.
SELECT * FROM Employee WHERE city=”Seoul”;
Note: 4 sub parts at a time please -- Policy of Chegg
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.