Variable Length Field in Database

Is there a way to save a variable-length list in a database in SQL or any other database engine?

Here the list means no. elements in the array. E.g. array of numbers.

But in my actual application, the things to be saved are objects and therefore cannot be saved simply as a comma-separated list.

+3
source share
5 answers

Some SQL databases support the ARRAY type as a column type. ARRAY is a variable length and may contain objects of the same type. See Details below that apply to databases that support the SQL standard:

http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#N106FE

+2

. .

+3

:

Id (PK), ListItem varchar (255), ListId (int) - ListId , , , .

() -ListId (pk) -ListTitle varchar (255)

() -ItemId (pk) -ListId (fk → List.ListId) -ItemName varchar (255) -Order (int) -

+1

1 ?

, , () ?

0

You can use the length function to calculate the length of a variable, and when you insert this variable, Insert the length with it ... This is it.

DOWNLOAD ENCODING ...

0
source

Source: https://habr.com/ru/post/1781601/


All Articles