GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

SQL flash cards

Janine Love computer science Englisch 11 Karten

SQL flash cards

Karten in diesem Stapel (11)

  1. 1UPDATE (definition)Modify existing records in a table
  2. 2UPDATE the first customer (CustomerID = 1) with a new contact person and a new city.UPDATE CUSTOMERS SET ContactName = 'Janine', City= 'New York' WHERE CustomerID = 1;UPDATE the first customer (CustomerID = 1) with a new contact person and a new city.
  3. 3IF() (definition)Like a ternary: IF(condition, true result, false result)
  4. 4Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update statement and no intermediate temp table.UPDATE salary SET sex = IF(sex = 'm', 'f', 'm');Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m...
  5. 5output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.SELECT * from cinema WHERE MOD(id, 2) = 1 AND NOT description = 'boring' ORDER BY rating DESC;output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.
  6. 6GROUP BYOften used with the COUNT() function; forms subgroups from rows based on columns data
  7. 7—SELECT email FROM Person GROUP BY email HAVING Count(email) > 1;SELECT email FROM Person GROUP BY email HAVING Count(email) > 1;
  8. 8HAVING clauseThe HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.
  9. 9List the number of customers in each country, ordered by the country with the most customers first.SELECT Count(CustomerID), Country, FROM Customers GROUP BY Country ORDER BY Count(CustomerID) DESC;
  10. 10LEFT (outer) JOINGood for when you want to include all the output of the first (left) table regardless of whether it has a foreign key in the second tableLEFT (outer) JOIN
  11. 11—SELECT FirstName, LastName, City, State
    FROM Person LEFT JOIN Address ON Person.PersonId = Address.PersonId;
    SELECT FirstName, LastName, City, State FROM Person LEFT JOIN Address ON Person.PersonId = Address.PersonId;

Informationen

Beschreibung
computer science Karteikarten am SQL flash cards, erstellt von Janine Love am 09/03/2019.
Erstellt von
Janine Love · Mär 2019
Aktualisiert
9 Mär 2019
Aufrufe
8
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck