1

I have 2 tables. One is called artist. Here is the table structure:

artistID lastname firstname nationality dateofbirth datedcease

The other table is called work

workId title copy medium description artist ID

What is the SQL query to list the details of any works of art (including artist who created the work) that have more than one copy recorded in the database?

1 Answer 1

1

Try this:

SELECT 
  w.copy, w.title, w.description, w.medium, 
  a.firstname + ' ' + a.lastname AS 'Artist created the work'
FROM artists a
INNER JOIN
(
    SELECT * 
    FROM work 
    WHERE artistID IN
    ( 
        SELECT artistID
        FROM work 
        GROUP BY artistID
        HAVING COUNT(*) > 1 
    )
) w ON a.artistID = w.artistID

Here is a demo in SQL Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.