Results 1 to 7 of 7

Thread: how to list 10 sufficient employee in sql ?

  1. #1
    Join Date
    Aug 2016
    Posts
    2

    how to list 10 sufficient employee in sql ?

    How can I answer this question in SQL?

    "List of 10 sufficient employees in X corporation".

    car(price, manufactor.id, color, createdbyid, creationdate),
    manufactor(name, id),
    employee(id, name, salary)

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What do you mean by sufficient employee?

  3. #3
    Join Date
    Aug 2016
    Posts
    2
    the employees with lower salary than others and who have created more cars than others(createdbyid)

  4. #4
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Based on tables you have listed, I don't see any relation between employee and car.

  5. #5
    Join Date
    Aug 2019
    Location
    chennai
    Posts
    1
    Hi all.
    Can you pls explain detail about sql


    **Links removed by Site Administrator so it doesn't look like you're spamming us. Please don't post them again.**

  6. #6
    Join Date
    Aug 2022
    Posts
    20
    To list the top 10 employees in SQL, you can use a SELECT statement with an ORDER BY clause and a LIMIT clause. The ORDER BY clause is used to sort the results based on a specific column, and the LIMIT clause is used to limit the number of rows returned.

    Here is an example of how you can list the top 10 employees based on their salary:

    SELECT * FROM employees
    ORDER BY salary DESC
    LIMIT 10;

    This will return the top 10 employees with the highest salary.

  7. #7
    Join Date
    Nov 2020
    Posts
    26
    lower salary AND more cars? Which has priority? Sort by number of cars then by salary and limit to 10?

    Build an aggregate query that counts cars by employee then join that query to employee table. Do sort and limit in that query.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •