Here is my code snippet.
What I wanna achieve is that to make the order of the price column going from 1000000 to null.
so to basically reverse the original sequence.
Okay I posted the wrong question the 1st time, what I need to know is how to select the table and make it looks like this:
name | email | money_total_spent_perperson
Doctor Who|doctorwho@timelords.com | 1001000
Harry Potter|harry@potter.com |40
Captain Awesome|captain@awesome.com | NULL
Here is the original table:
CREATE TABLE customers (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
email TEXT);
INSERT INTO customers (name, email) VALUES ("Doctor Who", "doctorwho@timelords.com");
INSERT INTO customers (name, email) VALUES ("Harry Potter", "harry@potter.com");
INSERT INTO customers (name, email) VALUES ("Captain Awesome", "captain@awesome.com");
CREATE TABLE orders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
customer_id INTEGER,
item TEXT,
price REAL);
INSERT INTO orders (customer_id, item, price)
VALUES (1, "Sonic Screwdriver", 1000.00);
INSERT INTO orders (customer_id, item, price)
VALUES (2, "High Quality Broomstick", 40.00);
INSERT INTO orders (customer_id, item, price)
VALUES (1, "TARDIS", 1000000.00);
select customers.name,customers.email,orders.item,orders.price
from customers
left outer join orders
on customers.id = orders.customer_id
;
how am I gonna do that?