Preview

cheat sheet

Powerful Essays
Open Document
Open Document
1430 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
cheat sheet
RESIDES (PERSON_NAME, STREET, CITY, STATE)WORKS (PERSON_NAME, COMPANY_NAME, SALARY)ADDRESS (COMPANY_NAME, CITY, STATE, ZIP)MANAGES (PERSON_NAME, MANAGER_NAME)
3. Find all employees who live in the same city and street as their manager (3 pts)
SELECT R.PERSON_NAME, M.MANAGER_NAME, R.STREET, R.CITY, R2.STREET, R2.CITY
FROM RESIDES R, MANAGES M, RESIDES R2
WHERE R.PERSON_NAME = M.PERSON_NAME AND M.MANAGER_NAME =
R2.PERSON_NAME AND R.STREET = R2.STREET AND R.CITY = R2.CITY
4. Find all persons who do not work for any company (3 pts)
SELECT R.PERSON_NAME
FROM RESIDES R
EXCEPT
SELECT W.PERSON_NAME
FROM WORKS W
5. Find the number of employees for each of the managers (3 pts)
SELECT M.MANAGER_NAME, COUNT(*) AS ‘# of Employees’
FROM MANAGES M
GROUP BY M.MANAGER_NAME
6. Give all employees of ‘Nutiva’ a salary raise of 10% (2 pts)
UPDATE WORKS W SET SALARY = SALARY * 1.1
WHERE W.COMPANY_NAME = ‘Nutiva’
7. Layoff all employees of ‘LiveChat’ (3 pts)
DELETE FROM MANAGES
WHERE PERSON_NAME IN
(SELECT PERSON_NAME
FROM WORKS
WHERE COMPANY_NAME = 'LiveChat')
DELETE FROM WORKS
WHERE COMPANY_NAME = ‘LiveChat’
8. Give all managers of ‘Zubecon’ a 10 percent raise, unless their salary becomes greater than $120,000. In such cases, give only a 4% raise. (5 pts)
UPDATE MANAGES M, WORKS W SET W.SALARY = W.SALARY*1.04
WHERE M.MANAGER_NAME = W.PERSON_NAME AND W.COMPANY_NAME =
‘Zubecon’
AND W.SALARY*1.1 > 120000;
UPDATE MANAGES M, WORKS W SET W.SALARY = W.SALARY*1.1
WHERE M.MANAGER_NAME = W.PERSON_NAME AND W.COMPANY_NAME =
‘Zubecon’
AND W.SALARY*1.1 <= 120000;
4. Find name, city, state of all persons who do not work for any company (5 pts)
P [R.PERSON_NAME, R.CITY, R.STATE] ( S [N.PERSON_NAME=R.PERSON_NAME] (R[N](P[PERSON_NAME] RESIDES ─ P[PERSON_NAME] WORKS) X R[R] RESIDES) )
 The actual specification of attributes for a given relation is driven by an analysis of “Functional Dependencies” amongst attributes of the proposed relation
 A “Functional Dependency” is a constraint between two

You May Also Find These Documents Helpful

  • Good Essays

    stat 202 cheat sheet

    • 509 Words
    • 3 Pages

    r2 = fraction of variation in one variable that is explained by least-squares on the other variable…

    • 509 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Gbt1 Task 3 Summary

    • 4026 Words
    • 17 Pages

    Corrective action for administrative salaries: CBI’s management should implement the same system for admins that I suggested for their manufacturing personnel. Give time off during slow times in exchange for longer hours during peak times.…

    • 4026 Words
    • 17 Pages
    Better Essays
  • Powerful Essays

    2. My second recommendation is we instill employee stock option into place. This is a great way…

    • 2310 Words
    • 10 Pages
    Powerful Essays
  • Powerful Essays

    IST223 Crib sheet

    • 3425 Words
    • 7 Pages

    rectangles, and relationships are shown by lines between the rectangles. Attributes are generally listed within the rectangle. The many side of many relationships is represented by a crows footentity-relationship (E-R) modelA set of constructs and conventions used to create data models. The things in the users world are represented by entities, and the associations among those things are represented by relationships. The results are usually documented in an entity-relationship (E-R) diagramID-dependent entityan entity whose identifier includes the identifier of another entityidentifierwhich are attributes that name, or identify, entity instancesidentifying relationshipIn such relationships, the parent is always required, but the child (the ID-dependent entity) may or may not be required, depending on application requirements. Identifying relationships are shown with solid lines in E-R diagrams.is-aRelationships among supertype/subtype entitiesmandatoryat least one entity instance must participate in the relationshipmaximum cardinalityThe maximum cardinality is the maximum number of entity instances that can participate in a relationship instance.minimum cardinalityThe minimum cardinality is the minimum number of entity instances that must participate in a relationship instance.nonidentifying relationshiprelationship drawn with a dashed line (refer to Figure 5-7) is used between strong entities and is called a nonidentifying relationship because there are no ID-dependent entities in the relationship.null valueare a problem because they are ambiguous. They can mean that a value is inappropriate, unknown, or known, but not yet been entered into the databaseparentAn entity or row on the one side of a one-to-many relationshiprecursive relationshipoccurs when an entity type has a relationship to itself.relationship classAssociations among entity classesrelationship instanceassociations among entity instances.strong entityan entity that represents something that can exist…

    • 3425 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    cis3730_Exam1_Studyguide

    • 512 Words
    • 2 Pages

    Relationships: is a collection of data organized based on a model derived from 1st order predicate logic…

    • 512 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Cheat Sheet Stats

    • 2673 Words
    • 11 Pages

    Standard units tell you how many standard deviations above or below average a data value is…

    • 2673 Words
    • 11 Pages
    Good Essays
  • Powerful Essays

    ( NAME = N'Jeff Thompson Sr - POS 410 - IA - KVO_log', FILENAME = N'D:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Jeff Thompson Sr - POS 410 - IA - KVO_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)…

    • 1555 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    Statistics Cheat Sheet

    • 2126 Words
    • 11 Pages

    What proportion of a normal distribution is located in the tail beyond z = +2.00?…

    • 2126 Words
    • 11 Pages
    Good Essays
  • Good Essays

    Statistics Cheat Sheets

    • 1326 Words
    • 4 Pages

    * Yes because the p-value is less than 0.05 or No, because the p-value is greater than 0.05…

    • 1326 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Make everyone do mandatory overtime, give an incentive to do it, and minimize the backlog orders also.…

    • 285 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Database concepts

    • 586 Words
    • 3 Pages

    In relational database theory, a functional dependency is a constraint between two sets of attributes in a relation from a database.…

    • 586 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    A zero plan work

    • 296 Words
    • 2 Pages

    Undeserving employees will not get the salary raise- As around 15 % of employees are not committed to their work, they don’t deserve increase in their salary.…

    • 296 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The process of decomposing the universal relation schema R into a set of relation schemas D = {R1,R2, …, Rm} that will become the relational database schema by using the functional dependencies. Each attribute in R will appear in at least one relation schema Ri in the decomposition so that no attributes are “lost”.…

    • 2087 Words
    • 9 Pages
    Good Essays
  • Satisfactory Essays

    FROM Table1 INNER JOIN Table2 ON Table1.EmpId = Table2.Id INNER JOIN Table3 ON Table1.ClassId = Table3.Id WHERE Table.Active = 1…

    • 374 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    (Please note, your information will not be sold or given to outside entities. It is for internal use only. Thank you.)…

    • 270 Words
    • 3 Pages
    Satisfactory Essays

Related Topics