167k views
2 votes
You are querying a database that contains data about music. you are only interested in data related to the jazz musician miles davis. the names of the musicians are listed in the composer column. you write the following sql query, but it is incorrect.

what is wrong with the query?

User Yahel
by
7.9k points

1 Answer

3 votes

Final answer:

The student's question pertains to an incorrect SQL query regarding data on the musician Miles Davis. A correct query should specify the table and column correctly and use proper syntax, potentially with the LIKE operator for non-exact matches.

Step-by-step explanation:

The student's question concerns an SQL query to extract information related to the jazz musician Miles Davis from a database. Without seeing the exact query the student has written, it's impossible to pinpoint the error. However, a proper query to find records with 'Miles Davis' in the composer column might look something like this:

SELECT * FROM music WHERE composer = 'Miles Davis';

Make sure that the table name and column name are correctly specified, and that 'Miles Davis' is written as it appears in the database. Also, check for proper syntax, such as single quotes around the name, and a semicolon to end the query.

If the query needs to find any mention of Miles Davis, not just exact matches, the student might need to use the LIKE operator with wildcards:

SELECT * FROM music WHERE composer LIKE '%Miles Davis%';

This SQL query will find all records where the composer column includes the name Miles Davis anywhere in the field.

User Gra
by
7.5k points