Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Select COLUMN_name
from TABLE_name
where COLUMN NAME = 'something's'
While executing this query in PostgreSQL, it is showing an error as like below,
syntax error at or near "S".
The apostrophe in KEPLER'S is terminating the string early. Escape it, and proofread next time.
Select CONCEPTNAME from KM_CONCEPT_MAST where CONCEPTNAME='KEPLER''S LAWS OF PLANETARY MOTION'
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have one query in DB2 which use 'for fetch only' but I need to convert it into postgresql. What can we use it for that?
You don't need that in PostgreSQL. In PostgreSQL, any cursor can be used for a positioned UPDATE or DELETE.
Just omit the clause in PostgreSQL.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a table with field name out of type text
I want to get the rows which contains sub string "hello and good morning"
I have tried to write:
select *
from my_table
where out like 'hello and good morning%'
but it seems not working.
How can I get all the rows which contains sub string ?
According to given details, this should work.
select * from my_table where LOWER(out) like LOWER('%hello and good morning%')
Here is the fiddle.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
How can we get this output
results from query should be like:
Assessment
penalty
both values are coming from two different columns. I want to join these two columns but want results like above in single cell. so there should be new line for second column(but in same cell)
select assessment || E'\n' || penalty from wherever
or
select concat_ws(chr(10), assessment, penalty) from wherever
Note: I am assuming, since you didn't say, that neither column can be null.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I think I can only get value, subtract value (at Java) and update value. Is it possible to subtract value at cell at one query?
Yes, but you got the syntax a bit wrong:
UPDATE table SET number_of_people = number_of_people - 3 WHERE id = 487364
This assumes that number_of_people is an integer value.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
The community reviewed whether to reopen this question 5 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
For example:
Query1
abc:='select * from table1';
Query2
result:='create view'||quote_ident(view1)||'as'||abc;
I'm going to take a wild guess and assume you're trying to use dynamic SQL to create a view.
If so, use the EXECUTE statement.
abc := 'select * from table1';
result := 'create view '||quote_ident(view1)||' as ' || abc;
EXECUTE result;
Your query text looked OK except for the missing spaces, assuming that view1 is a text parameter.
(In future: include PostgreSQL version, exact text of any error message, the full code you're using, etc).