Split one column in different ones

Hi all!!

I want to split the column SKU into different ones by its delimiter ("-")
Any of you guys have any idea how to do it? Its not explained in the table transformation course so far

  EXAMPLE BELOW

SKU
A-12-3ER-123
B-444-GT
V-34-TRD-122

[https://www.codecademy.com/courses/sql-table-transformation/lessons/date-number-string-functions/exercises/date-number-string-function-generalizations]

in the example, are that the values currently stored in the database? Or do you want to split the values before storing them in the database? Is this exercise related? Or a personal project?

After splitting, then what? How do you know which column(s) the data should be stored?

These are values currently stored in the database and its a personal project

The expected result would be

STYLE   |MODEL   |COLOR   |COLLECTION
--------|--------|--------|----------
A       |12      |3ER     |123
B       |444     |GT      |NULL
V       |34      |TRD     |122

Difficult to say, you give very little information. What programming language/frameworks do you use to communicate with the database? What you want to do sounds like something that could be in the application layer.

I’m using SQL Server…

you are using this piece of software: https://nl.wikipedia.org/wiki/Microsoft_SQL_Server?

Seems possible to split:

https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring-index

but seems difficult for your use case

the logic you currently describe usually goes into your application layer. Where are you getting the SKU’s from?