
WHERE SUBSTR(l_name, 1, 1) > TO_NUMBER(‘P’)Įxplanation – TO_NUMBER function: The TO_NUMBER function converts a character value to a numeric datatype. Question 8 – Which of the following lines in the given code contains an error? LIKE ‘_AC_’ find all the strings which have exactly 4 characters and the 2nd and 3rd characters are A,C respectivelyĮxplanation – All of the above is true about Like Operator. LIKE ‘%ABC%’ finds all the strings which contain abc. LIKE ‘%abc’ finds all the strings end with abc.
Question 7 – Which of the following statements are true about LIKE operator in SQL?
SELECT class_id, last_name, student_id FROM students WHERE student_id LIKE %ABC% Īnswer- SELECT class_id, last_name, student_id FROM students WHERE student_id LIKE %ABC% Įxplanation – WHERE student_id LIKE ‘%_ABC_%’ selects all the job_ids that has ‘_ABC_’ substring in it (case insensitively).
SELECT class_id, last_name, student_id FROM students WHERE student_id LIKE ABC_%. SELECT class_id, last_name, student_id FROM students WHERE student_id = %ABC%. Question 6 – Given are the columns in the STUDENTS table, Which of the following statements will you use to retrieve a string that contains ‘_abc_’ in the ‘STUDENT_ID’ column? This indicates _ cardinalityĮxplanation – This indicates a teacher can mentor at most 1 student and a student can have at most 1 teacher as mentor. Question 5 – Consider a directed line(->) from the relationship set mentor to both entity sets student and teacher. So, the output will be ‘rststrst’ Hence the answer will be rststrst Question 4 – What will be the output of the following function call in SQL? Select Replace(‘pqrstpqr’, ‘pqr’, ‘rst’)Įxplanation – Replace(‘pqrstpqr’, ‘pqr’, ‘rst’) Here all the ‘pqr’ substrings of ‘pqrstpqr’ will be replaced by ‘rst’. He wants to join 2 tables using an equality operator.Įxplanation – If 2 tables are joined using equality operator then that join comes under the condition of Equi join. Question 3 – Kapil Dev is a good cricket administrator. With the help of adequate conditions we can perform any join operations Question 2 – Joins can be visualize as _ with _ :Īnswer- Cartesian product, some conditionĮxplanation – With the help of cartesian products we can get all the possible combinations between the tables. Which of the following joins he should use?Įxplanation – The result of right outer join contains all the matched and unmatched rows from the right table and only the matched rows from the left table He also wants that all the matched and unmatched tuples of the right table should be present in the result but only the matched rows of the left table should be present in the result after the join operation. He wants to join 2 relational tables related to sports. Question 1 – Ravi Sastri is a good coach.