2018-11-14

Practice Midterm 2 Solutions .

http://www.cs.sjsu.edu/faculty/pollett/157a.3.18f/?PracMid2.shtml

http://www.cs.sjsu.edu/faculty/pollett/157a.3.18f/?PracMid2.shtml

-- Practice Midterm 2 Solutions
  1. Express the following queries in relational algebra (assuming the movie database relations from the book): (a) for each year, total number of movies made in that year, sorted by increasing year, (b) Stars and the average year of the movies they appear in.

(a) τyear(γyear, COUNT(title) -> ctMovies(Movies)) (b) γstarName, AVERAGE(movieYear) -> avgYear(StarsIn)

By: Cindy Ho, Emerson Ye, Chico Malto, Hongbin Zheng

7. Express the following queries in relational algebra (assuming the movie database relations from the book): (a) for each year, total number of movies made in that year, sorted by increasing year, (b) Stars and the average year of the movies they appear in. (a) τyear(γyear, COUNT(title) -> ctMovies(Movies)) (b) γstarName, AVERAGE(movieYear) -> avgYear(StarsIn) By: Cindy Ho, Emerson Ye, Chico Malto, Hongbin Zheng

-- Practice Midterm 2 Solutions
  1. <br>

In ODL a many relation is represented by the keyword Set. A one relationship is represented by just the class name. Say there are two classes Star and Movies who have a many to one relationship. With Star being the one relationship and Movies the many relationship. Movies to Star is a Many to one relationship. Like below. <br> relationship Star star;<br>

becomes<br> <br> relationship Star star<br> inverse Star::starredIn; <br> and <br> relationship Set<Movie> starredIn; <br> becomes <br> <br> relationship Set<Movie> starredIn<br> inverse Movie::star;<br> <br>

  • David Bui, Yuta Sugiura, Kevin Prakasa
(Edited: 2018-11-14)
6. <br> In ODL a many relation is represented by the keyword Set. A one relationship is represented by just the class name. Say there are two classes Star and Movies who have a many to one relationship. With Star being the one relationship and Movies the many relationship. Movies to Star is a Many to one relationship. Like below. <br> relationship Star star;<br> becomes<br> <br> relationship Star star<br> inverse Star::starredIn; <br> and <br> relationship Set<Movie> starredIn; <br> becomes <br> <br> relationship Set<Movie> starredIn<br> inverse Movie::star;<br> <br> - David Bui, Yuta Sugiura, Kevin Prakasa

-- Practice Midterm 2 Solutions

&lt;nowiki&gt; Student Names: Alexander Duong Adam Ball Ada La Parameswaran Ranganthan

  1. Draw an example of the following as both an E/R and UML diagram: two related/associated entities/classes in a many one relationship where the relationship has two attributes

&lt;/nowiki&gt;

Resource Description for Question3.png

(Edited: 2018-11-14)
<nowiki> Student Names: Alexander Duong Adam Ball Ada La Parameswaran Ranganthan 3. Draw an example of the following as both an E/R and UML diagram: two related/associated entities/classes in a many one relationship where the relationship has two attributes </nowiki> ((resource:Question3.png|Resource Description for Question3.png))

-- Practice Midterm 2 Solutions

&lt;nowiki&gt; Student Names: Alexander Duong Adam Ball Ada La Parameswaran Ranganthan

  1. Express the following queries in SQL: (a) name and square of salary as sal2 of all movie executives making less than $1million, (b) All movies produced by MGM in increasing order of length.

a. SELECT name, salary * salary AS sal2 FROM executive WHERE salary &lt; 1000000;

b. SELECT * FROM movie WHERE studio = &quot;MGM&quot; ORDER by length; /(Note that not specifying a direction for ORDER defaults to ascending)/ &lt;/nowiki&gt;

(Edited: 2018-11-14)
<nowiki> Student Names: Alexander Duong Adam Ball Ada La Parameswaran Ranganthan 9. Express the following queries in SQL: (a) name and square of salary as sal2 of all movie executives making less than $1million, (b) All movies produced by MGM in increasing order of length. a. SELECT name, salary * salary AS sal2 FROM executive WHERE salary < 1000000; b. SELECT * FROM movie WHERE studio = "MGM" ORDER by length; /*(Note that not specifying a direction for ORDER defaults to ascending)*/ </nowiki>

-- Practice Midterm 2 Solutions

Group members: Hovsep Lalikian, Sam Esmaeili, Erin Yang, Wendy Chen

  1. Map weak entity sets and supporting sets to relations
  • Create relation R_W from a weak entity set W with supporting set E
  • Include all attributes of W as an attribute of R_W
  • Include foreign key reference to the key of the translation R_E to E
  • The key of R_W is the foreign key with the partial key of W
  1. Explain the datalog concepts of intentional databases, extensional databases, and a variable appearing safely in a rule.
  • Intentional DB - collection of all intentional predicates in a DB
  • Intentional predicate - predicate whose relation is computed by one or more datalog rules that are not facts
  • Extensional DB - collection of all extensional predicates in a DB
  • Extensional predicate - predicate whose relation is stored in a DB (datalog facts)
  • Safe variable - a variable that appears in a non-negated relational algebra of the body.

Ex: P(x, y) &lt;- Q(x, z), NOT R(w, x, y), x &lt; y. Not safe because w and y appear only in a negated relational subgoal. Y also appears in an arithmetic operation.

Group members: Hovsep Lalikian, Sam Esmaeili, Erin Yang, Wendy Chen 5. Map weak entity sets and supporting sets to relations - Create relation @BT@R_W@BT@ from a weak entity set W with supporting set E - Include all attributes of W as an attribute of @BT@R_W@BT@ - Include foreign key reference to the key of the translation @BT@R_E@BT@ to E - The key of @BT@R_W@BT@ is the foreign key with the partial key of W 8. Explain the datalog concepts of intentional databases, extensional databases, and a variable appearing safely in a rule. - Intentional DB - collection of all intentional predicates in a DB - Intentional predicate - predicate whose relation is computed by one or more datalog rules that are not facts - Extensional DB - collection of all extensional predicates in a DB - Extensional predicate - predicate whose relation is stored in a DB (datalog facts) - Safe variable - a variable that appears in a non-negated relational algebra of the body. Ex: P(x, y) <- Q(x, z), NOT R(w, x, y), x < y. Not safe because w and y appear only in a negated relational subgoal. Y also appears in an arithmetic operation.

-- Practice Midterm 2 Solutions

R(name, street, city, title, year)

{

! name !! street !! city !! title !! year |-

C. Fisher123 Maple St.HollywoodStar Wars1977
C. Fisher5 Locust Ln.MalibuStar Wars1977
-
C. Fisher123 Maple St.HollywoodEmpire Strikes Back1980
-
C. Fisher5 Locust Ln.MalibuEmpire Strikes Back1980
-
C. Fisher123 Maple St.HollywoodReturn of the Jedi1983
-
C. Fisher5 Locust Ln.MalibuReturn of the Jedi1983
}

There are no nontrivial dependencies. No attribute is determined by the other four. Therefore it is in BCNF. Here name -&gt;-&gt; Street, city. For a relation to be in 4NF, the left side of the MVD should be a super-key, but for the above relation, name is not a super key. Therefore, it is not in 4NF.


Names: Alex Frank, Dominic Dinh, Vinny Senthil, Parnika De

(Edited: 2018-11-14)
R(name, street, city, title, year) {| |- ! name !! street !! city !! title !! year |- | C. Fisher || 123 Maple St. || Hollywood || Star Wars || 1977 |- | C. Fisher || 5 Locust Ln. || Malibu || Star Wars || 1977 |- | C. Fisher || 123 Maple St. || Hollywood || Empire Strikes Back || 1980 |- | C. Fisher || 5 Locust Ln. || Malibu || Empire Strikes Back || 1980 |- | C. Fisher || 123 Maple St. || Hollywood || Return of the Jedi || 1983 |- | C. Fisher || 5 Locust Ln. || Malibu || Return of the Jedi || 1983 |} There are no nontrivial dependencies. No attribute is determined by the other four. Therefore it is in BCNF. Here name ->-> Street, city. For a relation to be in 4NF, the left side of the MVD should be a super-key, but for the above relation, name is not a super key. Therefore, it is not in 4NF. ---- Names: Alex Frank, Dominic Dinh, Vinny Senthil, Parnika De

-- Practice Midterm 2 Solutions

Names: Himanshu Mehta, Conover Wang, Ryan Moore, Sherwyn Sen, Andrew Yuan&lt;br&gt;

Perform 3NF Decomposition on R(A, B, C, D, E) AB-&gt;C AC-&gt;B AE-&gt;D

step 1. find minimal basis of FDs delete AB-&gt;C? (AB)+ AC-&gt;B -&gt; no AE-&gt;D -&gt; no can&#039;t delete&lt;br&gt; &lt;br&gt; delete AC-&gt;B?&lt;br&gt; (AC)+&lt;br&gt; AB-&gt;C -&gt; no&lt;br&gt; AE-&gt;D -&gt; no&lt;br&gt; can&#039;t delete&lt;br&gt; &lt;br&gt; delete AE-&gt;D?&lt;br&gt; (AE)+&lt;br&gt; AB-&gt;C -&gt; no&lt;br&gt; AC-&gt;B -&gt; no&lt;br&gt; can&#039;t delete&lt;br&gt; &lt;br&gt; minimal basis&lt;br&gt; -----&lt;br&gt; AB-&gt;C&lt;br&gt; AC-&gt;B&lt;br&gt; AE-&gt;D&lt;br&gt; &lt;br&gt; step 2. make relations from minimal basis&lt;br&gt; AB-&gt;C R(A,B,C)&lt;br&gt; AC-&gt;B R(A,B,C) --&gt; unnecessary&lt;br&gt; AE-&gt;D R(A,D,E)&lt;br&gt; &lt;br&gt; step 3. if none of the relations are a superkey, find superkey and add a new relation from that&lt;br&gt; (ABC)+ -&gt; no&lt;br&gt; (ADE)+ -&gt; no&lt;br&gt; &lt;br&gt; now find a superkey&lt;br&gt; del E? (ABCD)+ -&gt; no&lt;br&gt; del D? (ABCE)+ -&gt; (ABCDE) (from AE-&gt;D) &lt;br&gt; del C? (ABE)+ -&gt; (ABCE) (from AB-&gt;C) -&gt; (ABCDE) (from AE-&gt;D) &lt;br&gt; del B? (AE)+ -&gt; (ADE) (from AE-&gt;D) -&gt; no&lt;br&gt; del A? (BE)+ -&gt; no&lt;br&gt; &lt;br&gt; smallest superkey -&gt; (ABE)&lt;br&gt; so make R(A,B,E)&lt;br&gt; &lt;br&gt; answer: R(A,B,C,D,E) = R1(A,B,C) u R2(A,D,E) u R3(A,B,E)

(Edited: 2018-11-14)
Names: Himanshu Mehta, Conover Wang, Ryan Moore, Sherwyn Sen, Andrew Yuan<br> 1. Perform 3NF Decomposition on R(A, B, C, D, E) AB->C AC->B AE->D step 1. find minimal basis of FDs delete AB->C? (AB)+ AC->B -> no AE->D -> no can't delete<br> <br> delete AC->B?<br> (AC)+<br> AB->C -> no<br> AE->D -> no<br> can't delete<br> <br> delete AE->D?<br> (AE)+<br> AB->C -> no<br> AC->B -> no<br> can't delete<br> <br> minimal basis<br> -----<br> AB->C<br> AC->B<br> AE->D<br> <br> step 2. make relations from minimal basis<br> AB->C R(A,B,C)<br> AC->B R(A,B,C) --> unnecessary<br> AE->D R(A,D,E)<br> <br> step 3. if none of the relations are a superkey, find superkey and add a new relation from that<br> (ABC)+ -> no<br> (ADE)+ -> no<br> <br> now find a superkey<br> del E? (ABCD)+ -> no<br> del D? (ABCE)+ -> (ABCDE) (from AE->D) <br> del C? (ABE)+ -> (ABCE) (from AB->C) -> (ABCDE) (from AE->D) <br> del B? (AE)+ -> (ADE) (from AE->D) -> no<br> del A? (BE)+ -> no<br> <br> smallest superkey -> (ABE)<br> so make R(A,B,E)<br> <br> answer: R(A,B,C,D,E) = R1(A,B,C) u R2(A,D,E) u R3(A,B,E)

-- Practice Midterm 2 Solutions
  1. Define the following kinds of constraints and show with a diagram how to represent it in the E/R model: (a) key, (b) referential integrity constraint, (c) degree constraint.

a) A key for an entire set E is a set K of one or more attributes such that, given any two elements e1 and e2 of E, e1 and e2 cannot have identical values for each of the attributes in K. Every entity set must have a key. A classic example would be making attributes title and year key of the entity set Movies(title, year, length, genre). In an E/R Diagram, the key attributes are underlined.

Resource Description for Screen Shot 2018-11-14 at 3.29.09 PM.png

b) If an entity is involved in at most one tuple and at least once as well, but does not require all members of the many side to be involved with any entity of the one side, we use a referential integrity. An Example can be Teaches(Professor, Course) where the University only allows a course to have one professor. In an E/R Diagram, we would use a rounded arrow in the one side.

Resource Description for Screen Shot 2018-11-14 at 3.29.13 PM.png

c) To indicate the cardinality of the participants in a relationship using an inequality on the edge is called a degree constraint. An example could be the number of students allowed to be enrolled in a course is less than or equal to 40.

Resource Description for Screen Shot 2018-11-14 at 3.29.26 PM.png

&lt;u&gt;Group Members: &lt;/u&gt;

Sunil Thapa

Yosias Hailu

Yu Ning

Priscilla Ng

Monsi Magal

(Edited: 2018-11-14)
4) Define the following kinds of constraints and show with a diagram how to represent it in the E/R model: (a) key, (b) referential integrity constraint, (c) degree constraint. ---- a) A key for an entire set E is a set K of one or more attributes such that, given any two elements e1 and e2 of E, e1 and e2 cannot have identical values for each of the attributes in K. Every entity set must have a key. A classic example would be making attributes title and year key of the entity set Movies(title, year, length, genre). In an E/R Diagram, the key attributes are underlined. ((resource:Screen Shot 2018-11-14 at 3.29.09 PM.png|Resource Description for Screen Shot 2018-11-14 at 3.29.09 PM.png)) b) If an entity is involved in at most one tuple and at least once as well, but does not require all members of the many side to be involved with any entity of the one side, we use a referential integrity. An Example can be Teaches(Professor, Course) where the University only allows a course to have one professor. In an E/R Diagram, we would use a rounded arrow in the one side. ((resource:Screen Shot 2018-11-14 at 3.29.13 PM.png|Resource Description for Screen Shot 2018-11-14 at 3.29.13 PM.png)) c) To indicate the cardinality of the participants in a relationship using an inequality on the edge is called a degree constraint. An example could be the number of students allowed to be enrolled in a course is less than or equal to 40. ((resource:Screen Shot 2018-11-14 at 3.29.26 PM.png|Resource Description for Screen Shot 2018-11-14 at 3.29.26 PM.png)) <u>Group Members: </u> Sunil Thapa Yosias Hailu Yu Ning Priscilla Ng Monsi Magal

-- Practice Midterm 2 Solutions
  1. Give an example of a correlated and an example of an uncorrelated query, explain why your examples work.

&lt;u&gt;Correlated&lt;/u&gt;

When our subqueries are evaluated more than one for all the results used in a higher level query it&#039;s called corollated subqueries. In particular, nested subqueries that require the subquery to be evaluated many times, once for each assignment of a value to some term in the subquery.

The following query is from an Employee table that has firstName and dateOfBirth as two of its many attributes.

The query is correlated because subqueries change as we cycle over different firstNames.

SELECT firstName

FROM Employee E1

WHERE dateOfBirth < ANY

    (SELECT dateOfBirth

    FROM Employee E2

    WHERE E1.firstName = E2.firstName);

&lt;u&gt;Uncorrelated&lt;/u&gt;

Our subqueries are evaluated once and for all the result used in a higher level query.

The following query is from Movie DB schemas we have been using throughout this semester.

The query is uncorrelated because the innermost subquery gives a fixed list of movies Harrison Ford stars in, which does not change as we execute the outer query. Also, the 2nd inner query gives a fixed list producerC numbers. An easy to check if the subqueries are uncorrelated is imagining the subquery as a temporary table that is used through the whole query.

SELECT name 

FROM MovieExec

WHERE cert# IN

    (SELECT producerC#

     FROM Movies

     WHERE (title, year) IN

         (SELECT movieTitle, movieYear

          FROM StarsIn

          WHERE starName = 'Harrison Ford' ) );

&lt;u&gt;Group Members: &lt;/u&gt;

Sunil Thapa

Yosias Hailu

Yu Ning

Priscilla Ng

Monsi Magal

(Edited: 2018-11-14)
10) Give an example of a correlated and an example of an uncorrelated query, explain why your examples work. ---- <u>Correlated</u> When our subqueries are evaluated more than one for all the results used in a higher level query it's called corollated subqueries. In particular, nested subqueries that require the subquery to be evaluated many times, once for each assignment of a value to some term in the subquery. The following query is from an Employee table that has firstName and dateOfBirth as two of its many attributes. The query is correlated because subqueries change as we cycle over different firstNames. SELECT firstName FROM Employee E1 WHERE dateOfBirth < ANY (SELECT dateOfBirth FROM Employee E2 WHERE E1.firstName = E2.firstName); <u>Uncorrelated</u> Our subqueries are evaluated once and for all the result used in a higher level query. The following query is from Movie DB schemas we have been using throughout this semester. The query is uncorrelated because the innermost subquery gives a fixed list of movies Harrison Ford stars in, which does not change as we execute the outer query. Also, the 2nd inner query gives a fixed list producerC numbers. An easy to check if the subqueries are uncorrelated is imagining the subquery as a temporary table that is used through the whole query. SELECT name FROM MovieExec WHERE cert# IN (SELECT producerC# FROM Movies WHERE (title, year) IN (SELECT movieTitle, movieYear FROM StarsIn WHERE starName = 'Harrison Ford' ) ); <u>Group Members: </u> Sunil Thapa Yosias Hailu Yu Ning Priscilla Ng Monsi Magal
X

 

Query Statistics

https://www.yioop.com/thread/9476

Total Elapsed Time for Queries: 0.04442977905273438 seconds.
SELECT LOCALE_NAME, WRITING_MODE FROM LOCALE WHERE LOCALE_TAG ='en-US'
Time: 0.0003170967102050781 seconds.
SELECT COALESCE(MAX(UPDATE_TIMESTAMP), 0) AS MOST_RECENT FROM ITEM_IMPRESSION_SUMMARY WHERE USER_ID = 2 AND ITEM_TYPE = 3 AND ITEM_ID IN (SELECT GROUP_ID FROM USER_GROUP WHERE USER_ID = 2 AND STATUS = 1) AND UPDATE_PERIOD = -4
Time: 0.0003650188446044922 seconds.
DELETE FROM ITEM_IMPRESSION_SUMMARY WHERE USER_ID=? AND ITEM_ID=? AND ITEM_TYPE=? AND UPDATE_PERIOD = -4
Array ( [0] => 2 [1] => 9476 [2] => 1 )
Time: 0.003490924835205078 seconds.
INSERT INTO ITEM_IMPRESSION_SUMMARY VALUES (?, ?, ?, -4, ?, 0, -1, -1) ON CONFLICT DO NOTHING
Array ( [0] => 2 [1] => 9476 [2] => 1 [3] => 1789974701 )
Time: 0.002148866653442383 seconds.
UPDATE ITEM_IMPRESSION_SUMMARY SET NUM_VIEWS = NUM_VIEWS + 1 WHERE USER_ID=? AND ITEM_ID=? AND ITEM_TYPE=? AND UPDATE_PERIOD = -2 AND UPDATE_TIMESTAMP = 0
Array ( [0] => 2 [1] => 9476 [2] => 1 )
Time: 0.0001010894775390625 seconds.
DELETE FROM ITEM_IMPRESSION_SUMMARY WHERE USER_ID=? AND ITEM_ID=? AND ITEM_TYPE=? AND UPDATE_PERIOD = -4
Array ( [0] => 2 [1] => 303 [2] => 3 )
Time: 0.002130031585693359 seconds.
INSERT INTO ITEM_IMPRESSION_SUMMARY VALUES (?, ?, ?, -4, ?, 0, -1, -1) ON CONFLICT DO NOTHING
Array ( [0] => 2 [1] => 303 [2] => 3 [3] => 1789974701 )
Time: 0.002068042755126953 seconds.
UPDATE ITEM_IMPRESSION_SUMMARY SET NUM_VIEWS = NUM_VIEWS + 1 WHERE USER_ID=? AND ITEM_ID=? AND ITEM_TYPE=? AND UPDATE_PERIOD = -2 AND UPDATE_TIMESTAMP = 0
Array ( [0] => 2 [1] => 303 [2] => 3 )
Time: 9.179115295410156E-5 seconds.
SELECT COUNT(GI.ID) AS NUM FROM GROUP_ITEM GI WHERE GI.GROUP_ID IN (SELECT GROUP_ID FROM USER_GROUP WHERE USER_ID = ? AND STATUS = 1) AND GI.TITLE NOT LIKE ? AND GI.PUBDATE > ?
Array ( [0] => 2 [1] => %2% [2] => 1789974694 )
Time: 0.0002419948577880859 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-4 )
Time: 0.0001089572906494141 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-37 )
Time: 4.00543212890625E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-202 )
Time: 3.409385681152344E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-687 )
Time: 4.00543212890625E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-1115 )
Time: 3.504753112792969E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-1138 )
Time: 5.292892456054688E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-1140 )
Time: 3.409385681152344E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-1149 )
Time: 3.314018249511719E-5 seconds.
SELECT PARENT_ID FROM GROUP_ITEM WHERE GROUP_ID=? AND USER_ID=? AND TITLE=? LIMIT 1
Array ( [0] => -1 [1] => 2 [2] => 2-1152 )
Time: 3.600120544433594E-5 seconds.
SELECT * FROM GROUP_ITEM WHERE ID=? LIMIT 1
Array ( [0] => 9476 )
Time: 8.296966552734375E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 4.601478576660156E-5 seconds.
SELECT COUNT(DISTINCT GI.ID) AS NUM FROM GROUP_ITEM GI, SOCIAL_GROUPS G, USER_GROUP UG, USERS O WHERE GI.PARENT_ID='9476' AND NOT LOWER(group_name) LIKE LOWER('Personal$%') AND (UG.USER_ID='2' OR G.REGISTER_TYPE IN ('4','3') ) AND GI.USER_ID=O.USER_ID AND GI.GROUP_ID=G.GROUP_ID AND GI.GROUP_ID=UG.GROUP_ID AND (( G.MEMBER_ACCESS IN ('2','3','4', '5')) OR (G.OWNER_ID = UG.USER_ID OR UG.USER_ID = '1'))
Time: 0.001000165939331055 seconds.
SELECT DISTINCT GI.ID AS ID, GI.PARENT_ID AS PARENT_ID, GI.GROUP_ID AS GROUP_ID, GI.TITLE AS TITLE, GI.DESCRIPTION AS DESCRIPTION, GI.FLAG AS FLAG, GI.PUBDATE AS PUBDATE, GI.EDIT_DATE AS EDIT_DATE, G.OWNER_ID AS OWNER_ID, G.MEMBER_ACCESS AS MEMBER_ACCESS, G.GROUP_NAME AS GROUP_NAME, P.USER_NAME AS USER_NAME, P.USER_ID AS USER_ID, GI.TYPE AS TYPE, GI.UPS AS UPS, GI.DOWNS AS DOWNS, G.VOTE_ACCESS AS VOTE_ACCESS FROM GROUP_ITEM GI, SOCIAL_GROUPS G, USER_GROUP UG, USERS P WHERE GI.PARENT_ID='9476' AND NOT LOWER(group_name) LIKE LOWER('Personal$%') AND (UG.USER_ID='2' OR G.REGISTER_TYPE IN ('4','3') ) AND GI.GROUP_ID=G.GROUP_ID AND GI.GROUP_ID=UG.GROUP_ID AND (( G.MEMBER_ACCESS IN ('2','3','4', '5')) OR (G.OWNER_ID = UG.USER_ID OR UG.USER_ID = '1')) AND GI.PARENT_ID NOT IN (SELECT DISCUSS_THREAD FROM GROUP_PAGE WHERE TITLE LIKE '%$$%' AND DISCUSS_THREAD IS NOT NULL) AND P.USER_ID = GI.USER_ID ORDER BY GI.PUBDATE ASC LIMIT 10 OFFSET 0
Time: 0.02763986587524414 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.0001749992370605469 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 3.600120544433594E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 2.384185791015625E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 2.193450927734375E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 2.09808349609375E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 2.503395080566406E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 1.478195190429688E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 1.406669616699219E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 1.788139343261719E-5 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 1.502037048339844E-5 seconds.
SELECT * FROM GROUP_ITEM WHERE ID=? LIMIT 1
Array ( [0] => 9476 )
Time: 0.0001850128173828125 seconds.
SELECT OPTIONS FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 6.198883056640625E-5 seconds.
SELECT STATUS FROM USERS WHERE USER_ID = ?
Array ( [0] => 2 )
Time: 0.0002799034118652344 seconds.
SELECT USER_NAME FROM USERS WHERE USER_ID = ?
Array ( [0] => 2 )
Time: 0.0001909732818603516 seconds.
SELECT * FROM VISITOR WHERE ADDRESS = :address AND PAGE_NAME = :page_name LIMIT 1
Array ( [:address] => 216.73.216.124 [:page_name] => forbidden_time_out )
Time: 0.00032806396484375 seconds.
SELECT COUNT(DISTINCT G.GROUP_ID) AS NUM FROM USER_GROUP UG, SOCIAL_GROUPS G WHERE UG.USER_ID = ? AND UG.GROUP_ID = G.GROUP_ID AND ( UG.STATUS = 1 OR UG.STATUS = 5)
Array ( [0] => 2 )
Time: 0.0004549026489257812 seconds.
SELECT G.GROUP_ID AS GROUP_ID FROM SOCIAL_GROUPS G WHERE G.GROUP_NAME = ?
Array ( [0] => Personal$2 )
Time: 0.0001370906829833984 seconds.
SELECT USER_ID FROM USER_GROUP WHERE GROUP_ID = ?
Array ( [0] => -1 )
Time: 7.319450378417969E-5 seconds.
SELECT G.GROUP_ID AS GROUP_ID, G.GROUP_NAME AS GROUP_NAME, G.OWNER_ID AS OWNER_ID, O.USER_NAME AS OWNER, REGISTER_TYPE, UG.STATUS AS STATUS, G.MEMBER_ACCESS AS MEMBER_ACCESS, G.VOTE_ACCESS AS VOTE_ACCESS, G.POST_LIFETIME AS POST_LIFETIME, UG.JOIN_DATE AS JOIN_DATE, G.OPTIONS AS OPTIONS, G.RENDER_ENGINE AS RENDER_ENGINE, G.GROUP_THEME AS GROUP_THEME, G.PAGE_HEADER AS PAGE_HEADER, G.PAGE_FOOTER AS PAGE_FOOTER FROM SOCIAL_GROUPS G, USERS O, USER_GROUP UG WHERE (UG.USER_ID = :user_id) AND UG.GROUP_ID= :group_id AND UG.GROUP_ID=G.GROUP_ID AND OWNER_ID = O.USER_ID LIMIT 1
Array ( [:group_id] => 303 [:user_id] => 2 )
Time: 0.00020599365234375 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => -2 )
Time: 0.0004420280456542969 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.0002210140228271484 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.0001661777496337891 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.0001308917999267578 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.0001490116119384766 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 0.00014495849609375 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 6.604194641113281E-5 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 5.698204040527344E-5 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 5.698204040527344E-5 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 7.605552673339844E-5 seconds.
SELECT RENDER_ENGINE FROM SOCIAL_GROUPS WHERE GROUP_ID = ?
Array ( [0] => 303 )
Time: 2.980232238769531E-5 seconds.
SELECT G.GROUP_ID AS GROUP_ID, G.GROUP_NAME AS GROUP_NAME, G.OWNER_ID AS OWNER_ID, O.USER_NAME AS OWNER, REGISTER_TYPE, UG.STATUS AS STATUS, G.MEMBER_ACCESS AS MEMBER_ACCESS, G.VOTE_ACCESS AS VOTE_ACCESS, G.POST_LIFETIME AS POST_LIFETIME, UG.JOIN_DATE AS JOIN_DATE, G.OPTIONS AS OPTIONS, G.RENDER_ENGINE AS RENDER_ENGINE, G.GROUP_THEME AS GROUP_THEME, G.PAGE_HEADER AS PAGE_HEADER, G.PAGE_FOOTER AS PAGE_FOOTER FROM SOCIAL_GROUPS G, USERS O, USER_GROUP UG WHERE (UG.USER_ID = :user_id OR G.REGISTER_TYPE IN (3,4)) AND UG.GROUP_ID= :group_id AND UG.GROUP_ID=G.GROUP_ID AND OWNER_ID = O.USER_ID LIMIT 1
Array ( [:group_id] => 303 [:user_id] => 2 )
Time: 0.0003769397735595703 seconds.
SELECT STATUS FROM USER_GROUP WHERE USER_ID=? AND GROUP_ID=? LIMIT 1
Array ( [0] => 2 [1] => 303 )
Time: 9.298324584960938E-5 seconds.