Tutor profile: Anirudh Reddy P.
Subject: SQL Programming
What is a correlated subquery?
A correlated subquery is a subquery that contains a reference to a table (in the parent query) that also appears in the outer query. MySQL evaluates from inside to outside. Example: From the employees and job_history tables, you need to display details of those employees who have changed jobs at least once. The query would be like: SELECT first_name, last_name, employee_id, job_id FROM employees E WHERE 1 <= (SELECT COUNT(*) FROM Job_history WHERE employee_id = E.employee_id); Since there is a reference to the parent table in the outer query, it is a correlated subquery.
Subject: PHP Programming
What's the difference between mysqli_fetch_row, mysqli_fetch_object, mysqli_fetch_assoc, mysqli_fetch_array?
All of them retrieve the data from the query result but they differ in the way they store query data. The mysqli_fetch_row() function fetches one row from a result-set and returns it as an enumerated array. The mysqli_fetch_array() is just an extended version of the mysqli_fetch_row() function. In addition to storing the data in the numeric indices of the result array, the mysqli_fetch_array() function can also store the data in associative indices, using the field names of the result set as keys. The mysqli_fetch_assoc() function fetches a result row as an associative array. The mysqli_fetch_object() function returns the current row of a result set, as an object.
Suppose, a circle of maximum possible size is cut from a square sheet of side 'a' units. Then, a square of maximum possible size is cut from the resultant circle. What will be an area of the final square?
The side of the original square is 'a' units. Therefore, the area of the original square = a^2 units. The diameter of the circle that is cut from the original square will be 'a' units. Therefore, the diagonal of the square of maximum possible dimension that can be cut from the circle will be 'a' units. Since the diagonal of the final square is 'a' units, then its area = (a^2)/2 units, and the area of the new square will be 50% or half of the area of the original square.
needs and Anirudh Reddy will reply soon.