Home > database >  The select query didn't find the from keyword
The select query didn't find the from keyword

Time:09-24

Select id, name=(case name
1 then the when 'male'
Then the when 2 'female'
The else '0'
End)
From "student"

CodePudding user response:

Get rid of parentheses case when,

CodePudding user response:

Select id, case name
1 then the when 'male'
Then the when 2 'female'
The else '0'
End
From "student"

CodePudding user response:

Case the when cannot be separated from the forehead, it seems you are a novice in the novice
Select id, case WHEN name=1 then 'male'
WHEN then name=2 'female'
The else '0' END AS NAME
The from student;

CodePudding user response:

Tried the case when also can separate, but in PLSQL, looks like the table name add double quotation marks complains: table or view does not exist

CodePudding user response:

Select id, (case name
1 then the when 'male'
Then the when 2 'female'
The else '0'
End) name
From "student", "

Mainly is a question the equals sign is put behind the name is ok

CodePudding user response:

Name=the wrong grammar

CodePudding user response:

Select id, (case name
1 then the when 'male'
Then the when 2 'female'
The else '0'
End) name
From "student", "

CodePudding user response:

The table name should not need to use double quotation marks?

CodePudding user response:

This period of SQL statements, there are two problems:
1. To determine whether the student table in the data dictionary table name for lower case, if the name of the table in the data dictionary is lowercase, and then you add double quotation marks in the student table name is correct, if the name of the table in the data dictionary is uppercase, then you should remove the double quotes of SQL,
2. The case.. When statement error, can consult written 5 #,

Wish I could help you,

CodePudding user response:

Cannot use=, behind () AS the NAME, the NAME of the table don't need to add "" the case grammar note,

CodePudding user response:

Should not use the equal sign, and the CASE WHEN can't write separately

CodePudding user response:

 

Select id, case WHEN name=1 then 'male'
WHEN then name=2 'female'
The else '0' END AS NAME
The from student;

CodePudding user response:

Select id, (case name
1 then the when 'male'
Then the when 2 'female'
The else '0'
End) name
From "student"
  • Related