w3resource

SQL SORTING and FILTERING on HR Database: Display all the information about the department Marketing

SQL SORTING and FILTERING on HR Database: Exercise-5 with Solution

5. From the following table, write a SQL query to find the details of 'Marketing' department. Return all fields.

Sample table: departments


Sample Solution:

SELECT *
 FROM  departments
  WHERE department_name = 'Marketing';

Sample Output:

 department_id | department_name | manager_id | location_id
---------------+-----------------+------------+-------------
            20 | Marketing       |        201 |        1800
(1 row)

Relational Algebra Expression:

Relational Algebra Expression: Display all the information about the department Marketing.

Relational Algebra Tree:

Relational Algebra Tree: Display all the information about the department Marketing.

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display all the information about the department Marketing - Duration

Rows:

Query visualization of Display all the information about the department Marketing - Rows

Cost:

Query visualization of Display all the information about the department Marketing - Cost

Contribute your code and comments through Disqus.

Previous: From the following table, write a SQL query to find those employees who have no department number. Return employee_id, first_name, last_name, email,phone_number,hire_date, job_id, salary,commission_pct,manager_id and department_id.
Next: From the following table, write a SQL query to find those employees whose first name does not contain the letter ‘M’. Sort the result-set in ascending order by department ID. Return full name (first and last name together), hire_date, salary and department_id.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



SQL: Tips of the Day

MySQL export schema without data

mysqldump -h yourhostnameorIP -u root -p --no-data dbname > schema.sql

Ref: https://bit.ly/3xzB9dS