- 1

SQl query

If i have 3 tables A,B and C and each table contain three columns NAME,AGE,SEX i want to retrieve the name among three table whose name start with JACK.what is the sql single line query of this?

25th Nov 2019, 12:47 PM
Cheliyan
Cheliyan - avatar
2 Respuestas
+ 3
Net-clicks your suggestion would not work because it is a cartesian product of the 3 tables (if each table has 5 Jacks then the result would have 125 Jacks...) Cheliyan you need to use UNION keyword to combine queries from each separate table. UNION removes duplicates, UNION ALL keeps the original amount of lines from each subset.
25th Nov 2019, 8:54 PM
Tibor Santa
Tibor Santa - avatar