Asked by kenny
1.Write a query to display the names of the employees that do not have any department_id.
2. Write a query to display the names, salary and job_id of employees in department_id 40, 60 and 80. Display the name as a single column and label it as Full_Names.
2. Write a query to display the names, salary and job_id of employees in department_id 40, 60 and 80. Display the name as a single column and label it as Full_Names.
Answers
Answered by
MathMate
You will need the field definition of the employee table to get the correct answer, but it should look like this:
"SELECT name FROM employees WHERE department_id IS NULL;"
Replace the lowercase names by the field and table names.
You would benefit from following a tutorial, or reviewing your class notes.
An example tutorial for beginners is:
http://beginner-sql-tutorial.com/sql.htm
or a site with examples:
http://www.1keydata.com/sql/sql.html
For the second question, it would look something like:
COLUMN Full_name ALIAS CONCAT(TRIM(family_name),' ',TRIM(first_name));
SELECT Full_name,salary,job_id FROM employees WHERE department_id=40 OR department_id=60 OR department_id=80;
Having said that, I suggest you make an effort to write the query statements and post the problematic ones if there's any.
"SELECT name FROM employees WHERE department_id IS NULL;"
Replace the lowercase names by the field and table names.
You would benefit from following a tutorial, or reviewing your class notes.
An example tutorial for beginners is:
http://beginner-sql-tutorial.com/sql.htm
or a site with examples:
http://www.1keydata.com/sql/sql.html
For the second question, it would look something like:
COLUMN Full_name ALIAS CONCAT(TRIM(family_name),' ',TRIM(first_name));
SELECT Full_name,salary,job_id FROM employees WHERE department_id=40 OR department_id=60 OR department_id=80;
Having said that, I suggest you make an effort to write the query statements and post the problematic ones if there's any.
There are no AI answers yet. The ability to request AI answers is coming soon!