2. Retrieve

To get, or select, information from the database you will need the SELECT statement. It will return all the rows it finds and the columns you tell it to.

SELECT columna, columna2, ... FROM mi_tabla;

An example in action.

SELECT name FROM Artist;
...
Mela Tenenbaum, Pro Musica Prague & Richard Kapp
Emerson String Quartet
C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu
Nash Ensemble
Philip Glass Ensemble
...

If I wanted all the columns of my table, I only have to add an asterisk instead of the columns.

SELECT * FROM mi_tabla;
SELECT * FROM Artist;

It returns both the id column and the name one.

1|AC/DC
2|Accept
3|Aerosmith
4|Alanis Morissette
5|Alice In Chains
6|Antônio Carlos Jobim
7|Apocalyptica
8|Audioslave
Activity 1

Work with the Customer table.

  1. Show the Email column.
  2. Show the FirstName column.
  3. Show the FirstName and LastName columns.
  4. Show the Address, Phone and Fax columns.
  5. Show all the columns.

Solutions

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

The HTML over WebSockets approach simplifies single-page application (SPA) development and lets you bypass learning a JavaScript rendering framework such as React, Vue, or Angular, moving the logic to Python. This web application development book provides you with all the Django tools you need to simplify your developments with real-time results.

Buy the book

Help me keep writing

Every coffee gives me a push toward the next article.

Comments

There are no comments yet.