ruby monstas
play

Ruby Monstas Session 28 Agenda Introduction to databases, Part 1 - PowerPoint PPT Presentation

Ruby Monstas Session 28 Agenda Introduction to databases, Part 1 Exercises Introduction to databases Part 1 CSV Recap users.csv first_name,last_name,city,shoe_size Tatjana,Abt,Bern,42 Kasimir,Spitznogle,Luzern,46


  1. Ruby Monstas Session 28

  2. Agenda Introduction to databases, Part 1 Exercises

  3. Introduction to databases Part 1

  4. CSV Recap users.csv first_name,last_name,city,shoe_size Tatjana,Abt,Bern,42 Kasimir,Spitznogle,Luzern,46 Niklas,Laberenz,Zürich,42 Konstanze,Gotti,Zürich,43 Romy,Ebner,Bern,38

  5. CSV Recap users.csv column table first_name last_name city shoe_size Tatjana Abt Bern 42 Kasimir Spitznogle Luzern 46 Niklas Laberenz Zürich 42 Konstanze Gotti Zürich 43 row Romy Ebner Bern 38

  6. Enter SQLite! SQL: Structured Query Language SQLite: One implementation of SQL Many other implementations are available: MySQL, PostgreSQL, Microsoft SQL Server, ...

  7. Creating a table Create a new table called “users” which has the following columns: first_name (string), last_name (string), city (string), shoe_size (integer)! CREATE TABLE 'users' (first_name string, last_name string, city string, shoe_size integer );

  8. Inserting data into a table Insert a new row into the table “users” with these values: “Tatjana”, “Abt”, “Bern”, 42. INSERT INTO 'users' VALUES ('Tatjana', 'Abt', 'Bern', 42);

  9. Some more data... INSERT INTO 'users' VALUES ('Kasimir', 'Spitznogle', 'Luzern', 46); INSERT INTO 'users' VALUES ('Niklas', 'Laberenz', 'Zürich', 42); INSERT INTO 'users' VALUES ('Konstanze', 'Gotti', 'Zürich', 43); INSERT INTO 'users' VALUES ('Romy', 'Ebner', 'Bern', 38);

  10. Who are our users from Bern? Give me the first name and the last name of all the rows from the table user, where the city is “Bern”! SELECT first_name, last_name FROM users WHERE city == 'Bern';

  11. What’s the biggest shoe size? Give me the maximum value of the column shoe_size from the table user! SELECT max (shoe_size) FROM users;

  12. Other weird queries Give me the values of the column city from the table users whose first_name starts with a “K”! SELECT city FROM users WHERE first_name LIKE 'K%'; Give me the values of the column shoe_size from the table users whose first_name or last_name contain a “z”! SELECT shoe_size FROM users WHERE first_name LIKE '%z%' OR last_name LIKE '%z%';

  13. Your feedback, please? http://goo.gl/forms/rUrZqOPNq6 (Session 27)

  14. Time to practice

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend