How to add first name and last name in sql


Asked by admin @ in Computers and Technology viewed by 282 People


Write the SQL code required to list the employee number, last name, first name, and middle initial of all employees whose last names start with Smith. In other words, the rows for both Smith and Smithfield should be included in the listing. Sort the results by employee number. Assume case sensitivity.

Answered by admin @



Answer:

The SQL Code to this question can be given as:

Assume that

employee number= EMP_NUMBER //employee number

last name=EMP_L_NAME //employee last name

first name=EMP_F_NAME //employee first name

middle initial=EMP_M_INITIAL //middle initial

employee =EMP //table name

Code:

SELECT EMP_NUMBER ,EMP_L_NAME,EMP_F_NAME,EMP_M_INITIAL

FROM EMP WHERE EMP_L_NAME LIKE '%Smith%'

ORDER BY EMP_NUMBER

Explanation:

In the above SQL(Structure Query Language). It is used to communicate to the database in the form of a query. In the database, there is a table that is an employee(EMP).In this table there are employee number(EMP_NUMBER), last name(EMP_L_NAME) ,first number(EMP_F_NAME) and middle initial(EMP_M_INITIAL) columns. In the above code firstly we use the select command. This command used to return a set of records from the table. This command is part of DML(Data Manipulation Language). In the select command, we select the column that's data we want. then we define the table name where data stored. Then we apply condition by using where clause in that clause we use (%) sign for search data and use the order by clause for show the data into the order of employee number(ascending order).


Similar Questions

What is first name and last name in tamil

Asked by admin @ in Math viewed by 332 persons

What is meant by first name and last name in tamil?

What was the name of the first spacecraft in space

Asked by admin @ in History viewed by 282 persons

The _____ spacecraft named ________ was the first object to orbit the Earth. A. U.S.; Apollo B. Soviet; Sputnik C. U.S.; Vostok ...?

How to say what is your last name in spanish

Asked by admin @ in Spanish viewed by 279 persons

Based on what you know about Spanish style last names, complete this family tree. Write the appropriate last names for each person in the spaces provided. (Thanks)

Name the first three planets in our solar system

Asked by admin @ in Science viewed by 337 persons

Name the first 3 planets in our solar system?​

Name the first 3 planets in our solar system

Asked by admin @ in Science viewed by 348 persons

Name the first 3 planets in our solar system?​

The first chairman of the atomic energy commission was name

Asked by admin @ in Social Sciences viewed by 262 persons

_____________was named as the first chairman of the atomic energy commission.(a) Dr Homi Bhabha. (b) Dr Homi sethna. (c) Dr A. P. J. Abdul Kalam. (d) Dr raja ramanna.

The first part of its name is a body part

Asked by admin @ in Science viewed by 272 persons

The first part of its name is a body part

Name the scholar who first calculated the value of pi

Asked by admin @ in World Languages viewed by 285 persons

Name the scholar who first calculated the value of pi _______​

The first name of the organism's scientific name is the

Asked by admin @ in Science viewed by 282 persons

The scientific name of organism is made up of its...... and. .

Last names in spanish speaking countries

Asked by maham237 @ in Spanish viewed by 358 persons

Spanish naming traditions are used not only in Spain, but also in the many Spanish-speaking regions of Latin America. Most people have one or two given names, followed by two …

The star of which sitcom shares his last name with a common type of wrench?

Asked by wiki @ in Social Studies viewed by 330 persons

The Office Home Improvement The Big Bang Theory The King of Queens

What is the name of the first manned us spacecraft

Asked by admin @ in Biology viewed by 272 persons

What was the name of the first manned U.S Spacecraft? A. Apollo 11 B. Sputnik 1 C. Voyager 1 D. Freedom 7

Name the first industrial country in the world

Asked by admin @ in History viewed by 333 persons

Name the first industrial country in the world (a) France (b) Japan (C) Britain (d) Germany​

Name of first english ship that came to india

Asked by admin @ in History viewed by 300 persons

Who came to India by Red Dragon Ship??

The first graphical browser for the www was named

Asked by admin @ in Computer Science viewed by 333 persons

The first graphical browser for the WWW was named:

Most viewed questions in Computers And Technology


A customer wants to increase the storage capacity by 25gb

Asked by admin @ in Computers and Technology viewed by 4429 persons




Solid yellow line bordering your lane of traffic marks a

Asked by admin @ in Computers and Technology viewed by 604 persons



Which of the following is not a windows utility program

Asked by admin @ in Computers and Technology viewed by 591 persons


When is a wrecker considered to be an emergency vehicle

Asked by admin @ in Computers and Technology viewed by 572 persons


Which operation on a pwc requires more than idle speed

Asked by admin @ in Computers and Technology viewed by 572 persons



Which of the following statements is true of a database

Asked by admin @ in Computers and Technology viewed by 559 persons


Which of the following is not true about an entrepreneur

Asked by admin @ in Computers and Technology viewed by 534 persons


Kitchen gadgets draw a context diagram for the order system

Asked by admin @ in Computers and Technology viewed by 511 persons