Re: Use of Datatype
Posted by: Peter Brawley
Date: August 24, 2022 04:07PM

> Representation INT(10) looked more like it will be a table definition
> of 10 INTs. Also as data type VARCHAR(45) is basically a table of 45 chars.

No. We can't just apply our own intuitions of datatype definitons. You'll need to read the manual pages on datatypes at https://dev.mysql.com/doc/refman/8.0/en/data-types.html.

Befoee MySQl 8.0., INT(n) defined one column of type INTEGER to be displayed in a width of n characters, which was not compliant with SQL standards and, as Shawn explains, somewhat incoherent, so since 8.0 the (n) in INT(n) is no longer supported.

In all MySQL versions, VARCHAR(n) defines one column which is a string of up to n characters.

> I have a task to store data that have related to other tables.
> This relation can be as one record in a table can have up to 20 relations to another table.

What do you mean by 20 relations, that there may be 20 rows containing matching instances of this value in another table? Or what?

> I could create 20 columns but I started to look for some other solutions
> to make it as readable as possible. Is there a chance of creating column
> types as tables for numbers?

Relational databases don't support tables within tables like that. So we can understand your requirement, please post a full & specific description of it.



Edited 1 time(s). Last edit at 08/25/2022 11:25AM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
April 08, 2022 12:30AM
April 08, 2022 09:37AM
April 08, 2022 02:44PM
August 24, 2022 03:18PM
Re: Use of Datatype
August 24, 2022 04:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.