Datatypes and Column Operations Assessment

Screen Link: Learn data science with Python and R projects

My Code:

SELECT *, | |, media_type
  FROM Media;

What I expected to happen: The correct answer

What actually happened: OperationalError: near “|”: syntax error

1 Like

Hey there!
You can just try this :slight_smile:

SELECT * FROM media_type;

You can take a look at this link for tips. Select statements SQL

Have a good day and I hope it helps.

Thank you. Tried that, unfortunately it gives me two columns I need it to look like this:

Media: MPEG audio file
Media: Protected AAC audio file

Etc…for a total of 5 rows 1 column

I thought you asked about the exercise in this link! Because I used the previous code, and the system accepted. (The correct answer).

But if you want just the first row, you can try this.

SELECT name FROM media_type;

It will give you this:

[5 rows x 1 columns]

name

MPEG audio file

Protected AAC audio file

Protected MPEG-4 video file

Purchased AAC audio file

AAC audio file

But I’m not sure how you can put this “Media:” In front of the row.

Going to continue looking :slight_smile:

The double pipe || will concatenate fields and or strings. No space btw the two pipes, and no commas are needed.

select 'Media: ' || name as Fancy_New_Column_Yall
from media_type;
1 Like