+ 1
I cant solve this practice test for days now, plz someone help!
Each employee receives a bonus once a year. The bonus for each employee is equal to their years of experience multiplied by 500. Write a query to output the firstname and lastname columns into one column named fullname separated by space, and the total annual salary for each employee keeping in mind bonuses named 'total'. Sort by the 'total' column
15 ответов
+ 7
After trying a lot, I've got this and worked:
SELECT CONCAT (firstname,' ',lastname)as fullname, (salary*12)+(experience*500) as total
FROM STAFF
ORDER BY total
+ 3
You need to use CONCAT instead of SELECT in your 3rd line.
SELECT CONCAT (firstname,' ',lastname) as fullname from staff;
CONCAT (salary*12+experience*500)
as total from staff;
order by total;
+ 2
SELECT CONCAT (firstname,' ',lastname)
as fullname from staff;
SELECT ((salary*12)+(experience*500)) as total from staff;
order by total
+ 2
SELECT CONCAT (firstname,' ',lastname)as fullname,((salary*12)+(experience*500)) as total from staff order by total;
+ 1
Answer is :
SELECT CONCAT (firstname,' ',lastname) as fullname, (salary*12)+(experience*500) as total
FROM STAFF ORDER BY total;
And it worked :)
+ 1
SELECT CONCAT (firstname, lastname) as fullname, (salary*12)+(experience*500) as total
FROM staff
ORDERED BY total;
+ 1
SELECT firstname, lastname,
experience*500 as total
FROM staff
ORDER BY total DESC
Expected Output
firstname,lastname,total
Seth,Gray,3000
David,Gibson,1500
Lisa,Anderson,1500
John,Smith,1000
Nelson,Gross,500
0
The code above is the best i came up with
0
Good day, please can anyone explain where the 12 is coming from?
0
SELECT concat (firstname, ' ' ,lastname) AS fullname, ((salary*12)+(experience*500)) as total from staff
order by total;
0
this is the correct answer
SELECT CONCAT (firstname,' ',lastname)as fullname, (salary*12)+(experience*500) as total
FROM STAFF
ORDER BY total
0
SELECT CONCAT (firstname,' ',lastname)as fullname, (salary*12)+(experience*500) as total
FROM STAFF
ORDER BY total
0
This is correct try thi code
select * from Employees
order by Salary DESC
limit 3
0
Use this code and process further.
SELECT CONCAT (firstname,' ',lastname) as fullname from staff,
CONCAT (salary*12+experience*500)
as total from staff
order by total
0
SELECT firstname, lastname,
experience*500 as total
FROM staff
ORDER BY total DESC
ONLY THIS WORKED