Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

isbn-norm.sql 491 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  1. --- #dep loc-mds-index-books
  2. --- #dep gr-index-books
  3. --- #dep ol-index
  4. --- #step Extract normalized ISBNs
  5. DROP TABLE IF EXISTS isbn_norm CASCADE;
  6. CREATE TABLE isbn_norm (
  7. isbn_id INTEGER PRIMARY KEY,
  8. norm_isbn EAN13 NOT NULL
  9. );
  10. INSERT INTO isbn_norm
  11. SELECT isbn_id, make_valid(isbn(isbn || '!'))
  12. FROM isbn_id WHERE isbn ~ '^\d{9}[\dxX]$';
  13. INSERT INTO isbn_norm
  14. SELECT isbn_id, make_valid(ean13(regexp_replace(isbn, '[xX]$', '0') || '!'))
  15. FROM isbn_id WHERE isbn ~ '^9\d{11}[\dxX]$';
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...