Question:
write the sql quries for below given schema...?
suri
2010-08-20 12:34:20 UTC
movies(title,year,length,gender,studioname,producerc#)
starIn(movietitle,movieyear,starname)
moviestar(name,adress,gender,birthdate)
movieexec(name,address,cert#networth)
studio(name,address,pressc#)
questions: 1. Find all stars that appeared either in a movie in 1990 or a movie with 'love' in titles?
2. Find all the stars who either are made or live in malibu( have string malibu as part of there address)?

plz help me out....
Three answers:
TheMadProfessor
2010-08-23 08:21:42 UTC
I'll walk you thru the method I ususally use to formulate this sort of query on the first one:



First, find all movies made in 1990: SELECT title FROM movies WHERE year = 1990



Next, all movies with 'love' in title: SELECT titile FROM movies WHERE TO_LOWER(title) LIKE "%love%"



Finally, combine the two resultsand list the stars (removing duplicates):

SELECT DISTINCT starname FROM starIn WHERE movietitle IN

(SELECT DISTINCT title FROM movies

WHERE year = 1990 OR TO_LOWER(title) LIKE "%love%")
Serge M
2010-08-20 21:49:44 UTC
Teach yourself at SQL Exercises: http://www.sql-ex.com/
AJ
2010-08-20 14:21:59 UTC
Need to know what your PK and FK are?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...