What does the <> operator do? [closed] - operators

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I came across the <> operator in some C code and couldn't figure out for sure what it ment.
I'm guessing it's equal to != (not equal to) operator?
Could somebody please enlighten me?
Am i right to think that <> and != are the same or...?
EDIT:
Ow this is embarrassing :$ I was looking in an SQLite3 statement in C code. So what i ment was SQLite3 and not C :$ Sorry for the confusion..!

There is no <> operator in C.

In SQL, <> means NOT EQUAL TO.

In Visual Basic means Not equal but it does not exist in C!
in c you may have << or >> which are binary shift left and right respectivelly

C has Greater than operator > and Less than operator <. It does not have any diamond operator <>. See here for more reference on C operators.

Ya, the <> operator indicates "Not Equal to" symbol but used in VB.net. I dont think this symbol is present in C language.

Related

SQL query giving aggregate function errors even whem I am not using any [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
Sorry for the whole BIG query pasted below. I have gone though it over and over and over and checked places where there might be calculation errors like dividing by zero, but none works. Right now it asks me to use group by clause, like the error we get when we have a count in the select statement, and don't use a group by clause. But When I put a group by clause at the end of the query with all the columns listed out, it tells me that the column names don't exists!
You are using sum on line 45 of your SQL:
(case ((sum(T.act_work_qty)+sum(T.remain_work_qty))*100.0)
when 0 then 0
when null then 0
else round((sum(T.act_work_qty)/(sum(T.act_work_qty)+sum(T.remain_work_qty))*100.0),2)
end)
Because of this, SQL assumes you have an aggregation query and returns an aggregation error.
Here are some ideas for workarounds . . .
Perhaps you don't need the sum, so you can just use the column value.
You can use a windows function to calculate the sum . . . sum(T.act_work_qt) over () will calculate the sum over all the rows processed by the query (the where clause conditions are applied).
Use a subquery to calculate the sum.

How to name a method properly? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
It's more a question about English grammar, but nevertheless, can you tell me which one is a correct method name? This ambiguity drives me crazy.
Method linesNumber returns number of "rows" in some sort of table.
I personally like "numberOfLines" variant, but linesNumber is shorter...
#pragma mark - RCGroupDataSource methods
- (NSUInteger)linesNumber { // ???: or numberOfLines or lineNumbers
return 2;
}
Always give full name as you can.
Method linesNumber returns number of "rows" in some sort of table.
why not use numberOfRowsInTable
You can refer AppleDocumentation and CocoaDevCentral
Describe what is being done:-
getNumberOfLines
The other could be ambiguous
getLineNumbers
Sound more like a plural, ie an array of numbers.

Is this an Oracle SQL bug? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have a column named TNAME of type nvarchar2(8) in my table. Length is 8 as you see. There are a few records in the table and all of them has 8 symbols in that column. When I select that column the value contains only 7 symbols. If I select length(TNAME) from mytable, result is 8!!!
see the pic.
Why is this happening, any idea?
ANOTHER PIC
Let's be quite clear about this: Oracle is not the most expensive database in the world because it habitually asserts ('CMN00632' = 'CMN0063') is true. So the problem lies somewhere in your set-up, either in your environment config or in your data itself.
You remain adamant that there is no problem with your GUI. There is no way for us to validate this. However, if you're wrong, you're the only person who's affected so we'll just assume you're right.
The other possibility then is that your data is corrupted in some fashion, perhaps non-printing characters. Is this problem affecting ebvery row or just certain values in the table?
Either way, there's a simple check you can run:
select dump(tname)
from merchants
where tname = 'CMN00632';
The output shoudl be the ASCII values for that string: 67,77,78,48,48,48,51,50.
Incidentally it would be quite straightforward to prove that there is no truncating format associated with that column: use a column alias . What does this query return?
select tname as some_new_name
from merchants
where tname = 'CMN00632';
the query is correct. As you can see the record matches with your condition CMN00632. The reason why you are getting the result upto only 3 is because the GUI cuts off the value. Try to resize your column TNAME and you will see the whole value.
This is happening because in setting, somewhere you have set to display the column data max to 7 characters.
If you execute your query in command prompt, you will see proper result.
Execute below query in your editor and see what it gives.
select '123456789' as test from merchants;
I bet this will give result as 1234567 in your editor that you are using.
Also one basic question, Do you think you will get the row displayed in your image with the query you have?

SQL to Rails Query [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can anyone Convert my Sql query into Rails Query???
SELECT DISTINCT conversation_cbgs.* FROM "conversation_cbgs"
INNER JOIN "message_cbgs"
ON "message_cbgs"."conversation_cbg_id" = "conversation_cbgs"."id"
INNER JOIN "user_message_cbgs"
ON "user_message_cbgs"."message_cbg_id" = "message_cbgs"."id"
WHERE "user_message_cbgs"."user_id" = 1
ORDER BY conversations_cbgs.updated_at DESC
Assuming you have your models built correctly - which would be helpful for those answering your questions, by the way - you would have something like:
Conversation.select("DISTINCT conversation_cbgs.*")
.joins(:messages)
.joins(:user_messages)
.where("user_message_cbgs.user_id = ?", 1)
.order("conversations_cbgs.updated_at DESC")
There are other ways using scopes and merges, etc. but you haven't posted any models for us to show you.
You have to first establish association between tables.If association is there then show it in question.
Or
You can execute this query by Model.find_by_sql(sql_query)
ConversationCbg.find(:all, :conditions=>["user_message_cbgs.user_id=?",1], :joins=>"As conversation_cbgs inner join message_cbgs on message_cbgs.conversation_cbg_id=conversation_cbgs.id inner join user_message_cbgs on user_message_cbgs.message_cbg_id=message_cbgs.id" , :select=>"Distinct conversation_cbgs.*", :order=> "conversations_cbgs.updated_at desc")

Error Returned from a Select/Inner Join Statement [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
When I try to run the following statement, an error message is returned:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'vendortofaultypeitemsmap'.
SQL Help indicates this message appears when "an object that does not exist is referenced". This table does exist and returns values if I run *select * from vendortofaulttypeitemsmap*. Can someone help me pinpoint what is wrong with the statement below that is causing the error message? Thanks in advance.
select
vendortofaulttypeitemsmap.vendorid,
vendortofaulttypeitemsmap.faultypeitemguid,
guid_faulttypeitems.faulttypeitemname,
vendortoworkactionmap.workactionitemguid,
guid_workactionitem.workactionitemname
from vendortofaultypeitemsmap
inner join guid_faulttypeitems on
vendortofaulttypeitemsmap.faultypeitemguid=
guid_faulttypeitems.faultypeitemguid
inner join guid_workactionitem on
vendortoworkactionmap.workactionitemguid=
guid_workactionitem.workactionitemguid
where vendortofaulttypeitemsmap.vendorid=45
You missed a 't' vendortofaultTypeitemsmap.
You have a typo. It is either vendortofaultypeitemsmap or vendortofaulttypeitemsmap.
Writing those table names out every time makes it easy to make typos. Use table aliases to simplify the whole thing, and change it to:
select v.VendorID, v.FaultTypeItemGUID, f.FaultTypeItemName,
v.WorkActionItemGUID, w.WorkActionItemName
from VendorToFaultTypeItemsMap v
inner join GUID_FaultTypeItems f on v.FaultTypeItemGUID = g.FaultTypeItemGUID
inner join GUID_WorkActionItem w on v.WorkActionItemGUID = w.WorkActionItemGUID
where v.VendorID = 45
With long names like that, using mixed case can also help you spot problems easier (assuming your database isn't set to case-sensitive).