Creating object/arrays in serverless Sql(cloudflare D1)
Answered
Anay-208 posted this in #help-forum
Anay-208OP
I'm planning on using cloudflare d1 for my app, now this is my table:
I want it such that in categories, I can store like an array of list of categories available.
What would be a good way to do that
CREATE TABLE products (
name VARCHAR(255) UNIQUE,
categories
);I want it such that in categories, I can store like an array of list of categories available.
What would be a good way to do that
Answered by B33fb0n3
first you need to learn how databases work and after that, you know the solution.
To directly give you the solution, you should look at the three normalization rules.
If you don't want to learn anything and just ask next time again, take a look at this:
https://phoenixnap.com/kb/wp-content/uploads/2021/05/normalized-database-example.png
After you looked at it, transform it to your question and you know the solution 👍
To directly give you the solution, you should look at the three normalization rules.
If you don't want to learn anything and just ask next time again, take a look at this:
https://phoenixnap.com/kb/wp-content/uploads/2021/05/normalized-database-example.png
After you looked at it, transform it to your question and you know the solution 👍
1 Reply
@Anay-208 I'm planning on using cloudflare d1 for my app, now this is my table:
sql
CREATE TABLE products (
name VARCHAR(255) UNIQUE,
categories
);
I want it such that in categories, I can store like an array of list of categories available.
What would be a good way to do that
first you need to learn how databases work and after that, you know the solution.
To directly give you the solution, you should look at the three normalization rules.
If you don't want to learn anything and just ask next time again, take a look at this:
https://phoenixnap.com/kb/wp-content/uploads/2021/05/normalized-database-example.png
After you looked at it, transform it to your question and you know the solution 👍
To directly give you the solution, you should look at the three normalization rules.
If you don't want to learn anything and just ask next time again, take a look at this:
https://phoenixnap.com/kb/wp-content/uploads/2021/05/normalized-database-example.png
After you looked at it, transform it to your question and you know the solution 👍
Answer