Can I do this relational algebra sentence in SQL? [closed] - sql

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 4 years ago.
Improve this question
π LOC, DEPTNO(DEPT) – πDEPTNO (σLOC-‘DALLAS’(DEPT))

The schemata of the left and right arguments of operator – (set difference) do not match: {LOC, DEPTNO} ≠ {DEPTNO}.
As is, this relational algebra query could not be evaluated.

Related

SQL: how to convert timestamp to datetime? [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 10 months ago.
Improve this question
I need to convert "2022-04-29T07:20:32.727Z" to "2022-04-29 07:20:32".
I am quite new to SQL and haven't found the solution.
You can use cast()
select cast('2022-04-29T07:20:32.727Z' as datetime)
Output
2022-04-29 07:20:32.727

How do i find difference of two columns in SQL [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 2 years ago.
Improve this question
I want to find if the difference between 2 columns. How do I achieve that?
For example,
select(col1-col2) output is 1
select(col2-col1) output is -1
Is there a way to get just the difference as 1 without the negative (-) sign?
use abs() function
select abs(col2-col1) as diff

getaliasesby command on SQL query [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 4 years ago.
Improve this question
now im investigating SQL Query for making Datawarehouse.
I found this query on it :
MAX(dbo.GetAliasesByWo(b_1.wo_part, b_1.wo__dec01, RTRIM(LTRIM(b_1.wo__chr01)), RIGHT(RTRIM(LTRIM(b_1.wo_rmks)), 1))) AS list_wo,
MAX(dbo.GetAliasesByWo1(b_1.wo_part, b_1.wo__dec01, RTRIM(LTRIM(b_1.wo__chr01)), RIGHT(RTRIM(LTRIM(b_1.wo_rmks)), 1))) AS list_wo1,
MAX(dbo.GetAliasesByWo2(b_1.wo_part, b_1.wo__dec01, RTRIM(LTRIM(b_1.wo__chr01)), RIGHT(RTRIM(LTRIM(b_1.wo_rmks)), 1))) AS list_wo2
did anyone knows whats the meaning ? could you explain to me ?
You can use sp_helptext command to view the definition.I think the given GetAliasesByWo is an user-defined function you can check the definititon with the below query:
EXEC [ServerName].[DatabaseName].dbo.sp_helptext 'dbo.GetAliasesByWo'

Sql code to create the Mirror image of the string in Oracle sql [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 7 years ago.
Improve this question
Team,
I need a sql query or function which will create the mirror image of string.
Thanks
Rajeev
If "mirror" is reversed text use:
SELECT REVERSE('my_text') FROM dual;
EDIT:
SqlFiddleDemo
SELECT t
,REVERSE(t) AS Mirror1
,TRANSLATE(t, 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror2
,TRANSLATE(REVERSE(t), 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror3
FROM tab;

drop everything to the right of a hyphen in sql [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 7 years ago.
Improve this question
I am using Oracle SQL developer 2012. My data looks like 'valueA-valueB'. I want to strip the content after - and populate with rest.
You can use a combination of substr and instr:
SELECT SUBSTR(my_column, 1, INSTR(my_column, '-') - 1)
FROM my_table