LeetCode 183. Customers_Who_Never_Order

Tutd Schema:

customers := relation{tuple{id 1, name "Joe"}, tuple{id 2, name "Henry"}, tuple{id 3, name "Sam"}, tuple{id 4, name "Max"}};
orders := relation{tuple{id 1, customerId 3}, tuple{id 2, customerId 1}};

key customers_pkey {id} customers;
key orders_pkey {id} orders;

Thinking Process:

TutorialD (master/main): :importtutd "183__Customers_Who_Never_Order.tutd"

TutorialD (master/main): :showexpr (customers not matching (orders{customerId} rename {customerId as id})){name}
┌──────────┐
│name::Text│
├──────────┤
│"Max"     │
│"Henry"   │
└──────────┘

What a one-liner! How nice!

留言

這個網誌中的熱門文章

185. Department Top Three Salaries