+ 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
1 Respuesta
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>%'