home / sakila

rental

27 rows where customer_id = 2

✎ View and edit SQL

This data as json, xlsx, CSV (advanced)

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

rental_id ▼ rental_date inventory_id customer_id return_date staff_id last_update
320 2005-05-27 00:09:24.000 1090 1090 2 2 2005-05-28 04:30:24.000 2 2 2020-12-23 07:15:24
2128 2005-06-17 20:54:58.000 352 352 2 2 2005-06-24 00:41:58.000 2 2 2020-12-23 07:15:49
5636 2005-07-10 06:31:24.000 4116 4116 2 2 2005-07-13 02:36:24.000 1 1 2020-12-23 07:16:40
5755 2005-07-10 12:38:56.000 2760 2760 2 2 2005-07-19 17:02:56.000 1 1 2020-12-23 07:16:42
7346 2005-07-27 14:30:42.000 741 741 2 2 2005-08-02 16:48:42.000 1 1 2020-12-23 07:17:05
7376 2005-07-27 15:23:02.000 488 488 2 2 2005-08-04 10:35:02.000 2 2 2020-12-23 07:17:05
7459 2005-07-27 18:40:20.000 2053 2053 2 2 2005-08-02 21:07:20.000 2 2 2020-12-23 07:17:07
8230 2005-07-29 00:12:59.000 1937 1937 2 2 2005-08-06 19:52:59.000 2 2 2020-12-23 07:17:18
8598 2005-07-29 12:56:59.000 626 626 2 2 2005-08-01 08:39:59.000 2 2 2020-12-23 07:17:23
8705 2005-07-29 17:14:29.000 4038 4038 2 2 2005-08-02 16:01:29.000 1 1 2020-12-23 07:17:25
9031 2005-07-30 06:06:10.000 2377 2377 2 2 2005-08-04 10:45:10.000 2 2 2020-12-23 07:17:30
9236 2005-07-30 13:47:43.000 4030 4030 2 2 2005-08-08 18:52:43.000 1 1 2020-12-23 07:17:33
9248 2005-07-30 14:14:11.000 1382 1382 2 2 2005-08-05 11:19:11.000 1 1 2020-12-23 07:17:33
9296 2005-07-30 16:21:13.000 4088 4088 2 2 2005-08-08 11:57:13.000 1 1 2020-12-23 07:17:34
9465 2005-07-30 22:39:53.000 3084 3084 2 2 2005-08-06 16:43:53.000 2 2 2020-12-23 07:17:36
10136 2005-07-31 21:58:56.000 3142 3142 2 2 2005-08-03 19:44:56.000 1 1 2020-12-23 07:17:46
10466 2005-08-01 09:45:26.000 138 138 2 2 2005-08-06 06:28:26.000 1 1 2020-12-23 07:17:50
10918 2005-08-02 02:10:56.000 3418 3418 2 2 2005-08-02 21:23:56.000 1 1 2020-12-23 07:17:57
11087 2005-08-02 07:41:41.000 654 654 2 2 2005-08-10 10:37:41.000 2 2 2020-12-23 07:17:59
11177 2005-08-02 10:43:48.000 1149 1149 2 2 2005-08-10 10:55:48.000 2 2 2020-12-23 07:18:00
11256 2005-08-02 13:44:53.000 2060 2060 2 2 2005-08-04 16:39:53.000 1 1 2020-12-23 07:18:01
11614 2005-08-17 03:52:18.000 805 805 2 2 2005-08-20 07:04:18.000 1 1 2020-12-23 07:18:06
12963 2005-08-19 06:26:04.000 1521 1521 2 2 2005-08-23 11:37:04.000 2 2 2020-12-23 07:18:25
14475 2005-08-21 13:24:32.000 3164 3164 2 2 2005-08-27 08:59:32.000 2 2 2020-12-23 07:18:47
14743 2005-08-21 22:41:56.000 4570 4570 2 2 2005-08-29 00:18:56.000 1 1 2020-12-23 07:18:51
15145 2005-08-22 13:53:04.000 2179 2179 2 2 2005-08-31 15:51:04.000 1 1 2020-12-23 07:18:57
15907 2005-08-23 17:39:35.000 2898 2898 2 2 2005-08-25 23:23:35.000 1 1 2020-12-23 07:19:08

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 14.545ms