2

So i went ahead for the 4 Hour SQL tutorial and really followed the video - failed on first task, not sure why - Using PopSQL

Im suspecting the difference in colour of INT and PRIMARY KEY might be indicative, not sure how to fix

Error: permission denied for schema public

CREATE TABLE student 
(
    student_id INT PRIMARY KEY,
    nama VARCHAR(20),
    major VARCHAR(20)
);

and this came out when I tried to run (I'm suspecting its about the difference in colour)

FAILED

permission denied for schema public LINE 1: ...017bc70-b89b-11ec-ad6c-97c51c55f0a9*/ CREATE TABLE student ( ^

The code I entered

problem continue after I removed the comma as suggested, using POPSQL fyi

Tutorial, the code is okay, mine is not

Tried using one of the answers provided

afirdaus04
  • 35
  • 1
  • 6
  • 1
    Having a look at the image, there's an extra comma, which's just before the closing parentheses, yields the error you met. eg. just remove that comma. – Barbaros Özhan Apr 10 '22 at 08:57
  • removed it , but problem still persist. Result after running it I have added picture – afirdaus04 Apr 10 '22 at 15:05
  • need to leave the statement **alone** as you already presented as the text in the question : `CREATE TABLE student( student_id ........, major VARCHAR(20));` – Barbaros Özhan Apr 10 '22 at 15:19
  • seeing different statements (`create table students...` and `create table yourScheme.student..`), and different errors (`near "GO"` and `denied for schema public`), , it's pretty unclear what the exact question is, please focus on 1 question at a time. – Luuk Apr 11 '22 at 14:08
  • I was following the answer given, just editing to show the result of those answer. Sorry real newbie here. Really I was following the Giraffe Academy tutorial and already stuck at 1.26hour which is literally the first task using PopSQL.....so trying to get answer here – afirdaus04 Apr 12 '22 at 14:43

1 Answers1

0

Solution 1. Get the ownership of the schema. See: GRANT Schema Permissions

Solution 2. Create a new schema. You will be the owner of the new schema.

CREATE SCHEMA yourScheme;
GO
CREATE TABLE yourScheme.student 
(
   student_id INT PRIMARY KEY,
   nama VARCHAR(20),
   major VARCHAR(20)
);
MB_18
  • 1,620
  • 23
  • 37