399 views
0 votes
0 votes

In SQL 3-Valued logic, what is the value of the following expression?
(x<y OR x≥y OR z=5)

  1. TRUE or FALSE but never UNKNOWN
  2. FALSE or UNKNOWN but never TRUE
  3. TRUE or UNKNOWN but never FALSE
  4. TRUE, FALSE or UNKNOWN

1 Answer

2 votes
2 votes

Let A = X<Y, then A' = X$\geq$Y
Now, A OR A' will always result in TRUE or UNKNOWN (if either X or Y or both are UNKNOWN)

Coming to Z = 5, it may be TRUE, FALSE or UNKNOWN
If Z = 5 is TRUE or FALSE, result will be TRUE or UNKNOWN depending on value of A OR A', but never FALSE.
If Z = 5 is UNKNOWN, result will be UNKNOWN. 

Hence, answer will be Option C.

Related questions

232
views
1 answers
0 votes
507
views
1 answers
0 votes
tishhaagrawal asked Dec 16, 2023
507 views
My doubt here is, if NOT EXISTS gets an empty set as the input then every tuple of the table in the outer query must satisfy the condition. Am I ... anyone please explain whether I am approaching this right, or if I am missing something?
595
views
2 answers
2 votes
24aaaa23 asked Oct 2, 2023
595 views
sql
Consider the label student (sid, sname, class, avg_marks).Q1: Select sid from student S1Where not exists(Select sid from student S where S.class=5 and S1 ... avg_marks.C. will show sid of student whose avg_marks is second highest.D.None
417
views
1 answers
2 votes
equimanthorn asked Sep 15, 2023
417 views
A SQL query is written in its format as clauses are arranged in a specific sequence and these clauses are executed in different sequence. If we're writing a query using ... to be replaced while writing it's execution order.A) 1B) 2C) 3D) 4