home / sakila

rental

4 rows where inventory_id = 2137

✎ View and edit SQL

This data as json, xlsx, CSV (advanced)

Suggested facets: staff_id, rental_date (date), return_date (date), last_update (date)

rental_id ▼ rental_date inventory_id customer_id return_date staff_id last_update
2101 2005-06-17 18:57:02.000 2137 2137 581 581 2005-06-20 15:38:02.000 2 2 2020-12-23 07:15:48
6326 2005-07-11 19:06:55.000 2137 2137 563 563 2005-07-12 20:41:55.000 1 1 2020-12-23 07:16:50
9807 2005-07-31 11:13:52.000 2137 2137 267 267 2005-08-02 07:34:52.000 1 1 2020-12-23 07:17:41
14633 2005-08-21 18:51:10.000 2137 2137 551 551 2005-08-25 13:07:10.000 1 1 2020-12-23 07:18:49

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE rental (
  rental_id INT NOT NULL,
  rental_date TIMESTAMP NOT NULL,
  inventory_id INT  NOT NULL,
  customer_id INT  NOT NULL,
  return_date TIMESTAMP DEFAULT NULL,
  staff_id SMALLINT  NOT NULL,
  last_update TIMESTAMP NOT NULL,
  PRIMARY KEY (rental_id),
  CONSTRAINT fk_rental_staff FOREIGN KEY (staff_id) REFERENCES staff (staff_id) ,
  CONSTRAINT fk_rental_inventory FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id) ,
  CONSTRAINT fk_rental_customer FOREIGN KEY (customer_id) REFERENCES customer (customer_id)
);
CREATE INDEX idx_rental_fk_inventory_id ON rental(inventory_id)
;
CREATE INDEX idx_rental_fk_customer_id ON rental(customer_id)
;
CREATE INDEX idx_rental_fk_staff_id ON rental(staff_id)
;
CREATE UNIQUE INDEX idx_rental_uq  ON rental (rental_date,inventory_id,customer_id)
;
Powered by Datasette · Queries took 9.496ms