Examveda

What will be the output of the following SQL statement?
SELECT person_id, fname, lname
FROM person
WHERE person_id=1;

A. Show only columns(person_id, fname, lname) but only those rows which belongs to person_id=1

B. Show all columns and rows

C. Shows only columns person_id

D. None of the mentioned

Answer: Option A

Solution (By Examveda Team)

This SQL statement is asking the database to show us some information about a specific person. Let's break it down:
SELECT person_id, fname, lname - This part tells the database which columns to display. It wants to show us the person_id (a unique ID number for each person), their first name (fname), and their last name (lname).
FROM person - This indicates that we are getting this information from a table called "person".
WHERE person_id=1 - This is the important part! It tells the database to only show us rows where the person_id is equal to 1. This means we will only see the information for one specific person, the one with person_id=1.
So, the correct answer is Option A: Show only columns (person_id, fname, lname) but only those rows which belong to person_id=1.
It will display the information for only the person with the person_id=1 and will only show the columns specified in the SELECT statement.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous