databases announcements create table and drop table
play

Databases Announcements Create Table and Drop Table Create Table - PowerPoint PPT Presentation

Databases Announcements Create Table and Drop Table Create Table 4 Create Table CREATE TABLE expression syntax: 4 Create Table CREATE TABLE expression syntax: column-def: 4 Create Table CREATE TABLE expression syntax:


  1. Databases

  2. Announcements

  3. Create Table and Drop Table

  4. Create Table � 4

  5. Create Table CREATE TABLE expression syntax: � 4

  6. Create Table CREATE TABLE expression syntax: column-def: � 4

  7. Create Table CREATE TABLE expression syntax: column-def: column-constraint: � 4

  8. Create Table CREATE TABLE expression syntax: column-def: column-constraint: � 4

  9. Create Table CREATE TABLE expression syntax: column-def: column-constraint: Examples: � 4

  10. Create Table CREATE TABLE expression syntax: column-def: column-constraint: Examples: CREATE TABLE numbers (n, note); CREATE TABLE numbers (n UNIQUE, note); CREATE TABLE numbers (n, note DEFAULT "No comment"); � 4

  11. Drop Table � 5

  12. Modifying Tables

  13. Insert � 7

  14. Insert For a table t with two columns... � 7

  15. Insert For a table t with two columns... To insert into one column: � 7

  16. Insert For a table t with two columns... To insert into one column: INSERT INTO t(column) VALUES (value); � 7

  17. Insert For a table t with two columns... To insert into one column: INSERT INTO t(column) VALUES (value); To insert into both columns: � 7

  18. Insert For a table t with two columns... To insert into one column: INSERT INTO t(column) VALUES (value); To insert into both columns: INSERT INTO t VALUES (value0, value1); � 7

  19. Insert For a table t with two columns... To insert into one column: INSERT INTO t(column) VALUES (value); To insert into both columns: INSERT INTO t VALUES (value0, value1); (Demo) � 7

  20. Update Update sets all entries in certain columns to new values, just for some subset of rows. � 8

  21. Update Update sets all entries in certain columns to new values, just for some subset of rows. (Demo) � 8

  22. Delete Delete removes some or all rows from a table. � 9

  23. Delete Delete removes some or all rows from a table. (Demo) � 9

  24. Python and SQL

  25. Python and SQL (Demo)

  26. SQL Injection Attack

  27. A Program Vulnerable to a SQL Injection Attack https://xkcd.com/327/ � 12

  28. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" https://xkcd.com/327/ � 12

  29. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" https://xkcd.com/327/ � 12

  30. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) https://xkcd.com/327/ � 12

  31. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  32. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  33. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  34. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  35. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  36. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.execute("INSERT INTO Students VALUES (?)", [name]) db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  37. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.execute("INSERT INTO Students VALUES (?)", [name]) db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert''); DROP TABLE Students; --' ); INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ � 12

  38. A Program Vulnerable to a SQL Injection Attack name = "Robert'); DROP TABLE Students; --" cmd = "INSERT INTO Students VALUES ('" + name + "');" db.execute("INSERT INTO Students VALUES (?)", [name]) db.executescript(cmd) INSERT INTO Students VALUES ( 'Robert''); DROP TABLE Students; --' ); INSERT INTO Students VALUES ( 'Robert' ); DROP TABLE Students; --'); https://xkcd.com/327/ https://xkcd.com/327/ � 12

  39. Database Connections

  40. Casino Blackjack Player: Dealer: � 14

  41. Casino Blackjack Player: Dealer: � 14

  42. Casino Blackjack Player: Dealer: � 14

  43. Casino Blackjack Player: Dealer: � 14

  44. Casino Blackjack Player: Dealer: � 14

  45. Casino Blackjack Player: Dealer: � 14

  46. Casino Blackjack Player: Dealer: � 14

  47. Casino Blackjack Player: Dealer: � 14

  48. Casino Blackjack Player: Dealer: � 14

  49. Casino Blackjack Player: (Demo) Dealer: � 14

Recommend


More recommend