Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Solved Assignments
Asked Questions
Answered Questions
example of add constraint in sqlexample alternative formulation for maxenrolmentsalter table isenrolledonadd constraint maxenrolmentscheck select
row counterparts of table operatorssql does not have counterparts tuple rename tuple projection tuple extension tuple join and tuple compose to
operators on tables and rowsrow extractiontuple from r sql has row subqueries these are just like scalar subqueries except that they may specify more
table comparison - sqlthe following definitions for relation comparisonslet r1 and r2 be relations having the same heading thenr1 sube r2 is
example of unwrap operator - sqlexample here shows how unwrapping can be done in longhand in sqlexample unwrapping in sqlletting contactinfowrapped
example of wrap operator - sqlthe effect of example can be obtained in sql but note that one needs to write down not only the names of the columns
wrapping and unwrapping in sqloperators wrap and unwrap in connection with attributes whose declared types are tuple types example shows how
unnest operator in sqlthe inverse operator of group is ungroup sql has an operator unnest that can be used for similar purposes but its method of
example of group by and collect operatorexample using group by and collect to obtain cer2select courseidcast collect row studentid markas row
example of groupby operatorexample how many students sat each examusing group by natural left join and coalesceselect courseid coalesce n 0 as nfrom
example of coalesce operatorexample give the total of marks for each exam simplified solutionselect courseidcoalesce select sum markfrom exammark as
example of cast operator so long as cast is used as shown we could obtain the total marks for each exam in similar fashion using sum mark as
example of using aggregation on nested tablesexample how many students sat each examwith cer as select courseid cast table select distinct studentid
using aggregation on nested tablesexample is the most direct translation of its counterpart in the theory book that can be obtained in sql but it is
example of tables within a table - sqlexample obtaining cer from course and exammarkselect courseid cast table select distinct studentid mark from
max and min operator in sqlexampleselect max mark from exammark where studentid s1select min mark from exammark where studentid s1example needs no
count operator in sqlexample counting the students who have scored more than 50 in some examselect count fromselect distinct studentidfrom
aggregate operators sqlsupports all of the aggregate operators mentioned in the theory book and many more besides the syntax however involves an
semijoin and composition - sqlfor semijoin the dyadic relational operator matching defined thusr1 matching r2 where r1 and r2 are relations such that
effects of null for union - sqlthe treatment of null in invocations of except is as for union this is different from its treatment in those of not in
semidifference via not in and a subqueryselect studentidfrom iscalledwhere name devinderand studentid not in select studentidfrom isenrolledonwhere
semidifference via except and join - sqlselect from select studentidfrom iscalledwhere name devinderexcept distinct correspondingselect
semidifference and not - sqlin this section first describe the relational difference operator named minus example here shows sqls closest counterpart
union all - sqlfurther varieties of union arise when we replace the key word distinct by all in any of the foregoing examples as in example all
union without corresponding - sqlthe use of union without corresponding example is merely by omitting corresponding but only because the operands