Код: Выделить всё
Customer | Product
Dave | Sneakers
Martin | Tooth Brush
Andrew | Shirt
Dave | Tooth Brush
< /code>
В SQL вы можете сделать < /p>
SELECT Customer, Product, DENSE_RANK() OVER (ORDER BY Customer) AS customer_id, DENSE_RANK() OVER (ORDER BY Product) AS product_id
Customer | Product | customer_id | product_id
Dave | Sneakers | 2 | 2
Martin | Tooth Brush | 3 | 3
Andrew | Shirt | 1 | 1
Dave | Tooth Brush | 2 | 3
< /code>
, что может быть полезно, если вы хотите разделить данные на три таблицы < /p>
Customer (customer_id, customer_name)
Product (product_id, product_name)
Customer_Product(customer_id, product_id)
Код: Выделить всё
#include
#include
#include
#include
using namespace std;
int main(){
const vector v = {7,9,9,7};
const auto dense_rank = views::zip(v | ranges::to(),views::iota(0)) | ranges::to() ;
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/780 ... w-function
Мобильная версия