+ 1

How to write the Sql query for search engine?(php)

my db has tables called movies and stars I want to match stars_name or/and movies_name from the text input in the search_box

21st Feb 2018, 11:17 AM
Pukhramabam Prameshwormani Singh
1 Answer
0
It depends on your table structure. I am assuming the following table structure and giving you the queries. create table stars( id int primary key, star_name nvarchar(50), ); create table movies( id int primary key, movie_name nvarchar(50) ); create table movie_stars( star_id int, movie_id int ) select * from stars where star_name like '%<query>%' select * from movies where movie_name like '%<query>%'
26th Feb 2018, 12:16 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar