Why does 'mkt_carrier_fl_num AS flight' return a syntax error 42601? [closed] - postgresql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm new to Postgres and everything databases. I'm learning through a Pluralsight course and have finally managed to import a database. Following along with what the teacher is typing out, I query:
SELECT fl_date,
mkt_carrier AS airline
mkt_carrier_fl_num AS flight
origin,
dest
FROM performance
WHERE origin = 'ORD'
.. from a database that came with the course files, and get back this:
ERROR: syntax error at or near "mkt_carrier_fl_num"
LINE 3: mkt_carrier_fl_num AS flight
^
SQL state: 42601
Character: 45
I've googled the error code but apparently this can entail many different things. I have no idea where to go from here. Literally every function in this program is a mystery to me.
Please help.

SELECT fl_date
,mkt_carrier AS airline -- comma before the start of the column name
,mkt_carrier_fl_num AS flight
,origin
,dest
FROM performance
WHERE origin = 'ORD';

Related

ERROR: invalid input syntax for type double precision: "$13.99" [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 days ago.
Improve this question
ERROR: invalid input syntax for type double precision: "$13.99".CONTEXT: COPY customer_purchase, line 2, column product_price: "$13.99".
This error pops up when I try to copy table from csv to sql database.I know the problem here is due to wrong data type used. And, I tried using every possible data type but still could not solve the problem.
I was trying to copy CSV table from excel to sql database(postgresql) and instead of showing output, an error occured.

PGSQL seems to ignore param passed in [closed]

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
Issue: If I call with valid parameter I get a whole lot of results I should not.
So, while it seems aware of parameters, they're not used as I would expect.
If I call with no parameter at all I get an error there is no such function, so that's expected.
If I call with valid parameter I get a whole lot of results I should not.
So, while it seems aware of parameters, they're not used as I would expect.
Workaround: I can be redundantly specific with a where clause, but I know there's something I'm missing here. I expect to pass a territory id and get ONLY results for that territory id. I'm getting all territories right now.
select * from by_territory_id('TER-123') where territory = 'TER-123';
Of course I want to simply do the following, as that is what wrapping this in a function is for:
select * from by_territory_id('TER-123');
If anybody can see what is wrong here please point it out? The parameter is supposed to be used in the WHERE clause of this function:
CREATE OR REPLACE FUNCTION by_territory_id (territory_id char)
RETURNS TABLE (customer_id char, territory char, scan_id int, scan_status iol.consignment_audit_scan_status) AS $$
select distinct con.customer_id, cus.primary_territory stm_territory, cas.id, cas.status
from iol.consignment con
join iol.products prod
on con.description = prod.description
join iol.customers cus
on con.customer_id = cus.customer_id
left join iol.territories_and_roles tr
on cus.primary_territory = tr.territory_id
left outer join iol.consignment_audits_scan cas
on cus.customer_id = cas.customer_id
where prod.lvl3_id in ('PREMIUM', 'STANDARD')
and tr.role = 'STM' and cus.primary_territory = territory_id
order by cas.id
$$ LANGUAGE SQL;
EDIT: Two down votes saying I'm not clear enough at the point of this edit. All the same, the one answer is correct. I hope it is okay that I really just needed eyes on this and I believe somebody else will run into the exact same issue, so rather than expand on the above I'm going to leave it be because the issue was indeed the name of my parameter (and PG gave no complaint or indication).
Looks like one of your tables has a column named territory_id, and that is what is getting invoked by you unqualified reference. You can qualify it with the function name:
and tr.role = 'STM' and cus.primary_territory = by_territory_id.territory_id
Or better yet change the spelling of the parameter so that it is distinct.

After creating tab bars and widgets the emulator gives such an error when opening the app [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I could not transfer my code to the site as I wrote it, but I placed your photo Please can you help me?
You are getting the error because you are trying to pass an uninitialized String to a Text-Widget (Naber). A Text-Widget can not handle uninitialized Strings which have the value null.
Therefore try initializing the String 'Naber' directly like:
String Naber = 'Some text';
This should work.

What text (in English) should I use when asking the user to overwrite a document? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I write a lot of applications in C# and I'm trying to sew up some holes in my standard practices.
Specifically, I'm trying to decide on the best text to use in a message box, and I thought I'd ask the StackOverflow community since I believe that many opinions are always better than one.
What I have currently is:
"Document XXX.docx already exists. Okay to overwrite?"
Buttons for; Yes, No and Cancel
I'm really interested to see which examples turn out to be the most popular.
There are no limits on the style used; formal, casual, humourous, etc. All suggestions are welcome. Aim to err safely within political correctness though.
On a small side note: It would also be great, but by no means essential, to consider that the same text could also be suitable for a command line program.
Please note: English language only please. For other languages, please raise a new question.
Personally, I like to see a bit more context and slightly different wording. Something like:
"<existing document name>" already exists in "<destination path>".
Would you like to replace it (Y/N)?
or perhaps with even more information:
"<existing document name>" (<bytes>) (<date modified>) already exists in
"<destination path>".
Would you like to replace it with file of size <new bytes>, last modified
<new date modified> (Y/N)?
I think "replace" is a bit more clear than "overwrite" - and (speculation) may translate into other languages, and maintain the intended meaning more often.
...and one last option with new file name/location info:
"<existing document name>" (<bytes>) (<date modified>) already exists in
"<destination path>".
Would you like to replace it with file "<new file name>" in "<new path>" of
size <new bytes>, last modified <new date modified> (Y/N)?
This last one would probably just show a temp file / buffer location for an initial file save--but it is reusable, and more meaningful when doing a file copy.
Hope you find one of these useful.
Cheers,
Hans
Title: Overwrite?
"XXX.docx exists.
Would you like to overwrite XXX.docx?"
Buttons: Overwrite, Keep, Panic
Simple solutions are usually best, for example windows user might find it familiar to see a message :
He has 3 options :
Replace
Abort action x3
Create with a new name

Please anyone be so kind help! Matlab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have this data of year, month, date. I want this to show as year,month,date in Matlab and don't know how to do.
X=(2014,01,02 2014,01,03 2014,01,07 2014,01,08 2014,01,09 2014,01,10 2014,01,13
2014,01,14 2014,01,15 2014,01,16 2014,01,17 2014,01,20 2014,01,21 2014,01,22
2014,01,23 2014,01,24 2014,01,27 2014,01,28 2014,01,29 2014,01,30 2014,01,31
2014,02,03 2014,02,04 2014,02,05 2014,02,06 2014,02,07 2014,02,10 2014,02,11
2014,02,12 2014,02,13 2014,02,14 2014,02,17 2014,02,18 2014,02,19 2014,02,20
2014,02,21 2014,02,24 2014,02,25 2014,02,26 2014,02,27 2014,02,28 2014,03,03)
The simplest way would be to reshape the matrix and use it accordingly. I demonstrate the way to reshape and print all the dates in US (MM/DD/YYYY) format.
X=[2014,01,02 2014,01,03 2014,01,07 2014,01,08 2014,01,09 2014,01,10 2014,01,13 2014,01,14 2014,01,15 2014,01,16 2014,01,17 2014,01,20 2014,01,21 2014,01,22 2014,01,23 2014,01,24 2014,01,27 2014,01,28 2014,01,29 2014,01,30 2014,01,31 2014,02,03 2014,02,04 2014,02,05 2014,02,06 2014,02,07 2014,02,10 2014,02,11 2014,02,12 2014,02,13 2014,02,14 2014,02,17 2014,02,18 2014,02,19 2014,02,20 2014,02,21 2014,02,24 2014,02,25 2014,02,26 2014,02,27 2014,02,28 2014,03,03];
X_in_better_format = reshape(X,3,42)';
for it = 1:size(X_in_better_format,1)
sprintf('The date is %d/%d/%d',X_in_better_format(it,2),X_in_better_format(it,3),X_in_better_format(it,1)) %US Format
end