M
M
Mar1ia2022-02-25 16:57:07
SQL
Mar1ia, 2022-02-25 16:57:07

Have the tasks for the current date been correctly solved, data extraction (basic knowledge of SQL)?

The tasks are taken with SHIFT+enter, the platform is closed, so it will not be possible to check the solutions. I would like to understand whether I think in the right direction or it is very far from understanding the language

to write two SQL queries.
1) There is a table with
exchange rates CURRENCY(DT DATE, VAL NUMBER(10,4)).
Every day, except for holidays and weekends, it receives an update of the value
of the exchange rate. This happens once a day.
Write a query that returns exchange rates for a given date.


CREATE TABLE CURRENCY(DT DATE, VAL NUMBER(10,4));
SELECT * FROM CURRENCY WHERE DT = CURRENT_DATE

And what other ways can be decided besides select?

2) There is a table with information about accounting accounts and postings. Write an SQL query to display accounts with less than 1000 transactions, given
that ACCOUNTD(ID_ACC, NUM_ACC) are accounts(a), OPERATIONS(ID_OP, ID_ACC1, ID_ACC2,
SUM_OP) are transactions(o)
.

CREATE TABLE ACCOUNTD(ID_ACC, NUM_ACC);
CREATE TABLE OPERATIONS (ID_OP, ID_ACC1, ID_ACC2,
SUM_OP) ;

INSERT INTO ACCOUNTD VALUES();
INSERT INTO OPERATIONS VALUES();

SELECT * FROM OPERATIONS WHERE SUM_OP = 1000;
SELECT ID_ACC, NUM_ACC, ID_OP, ID_ACC1, ID_ACC2,
SUM_OP
FROM `OPERATIONS`
INNER JOIN `ACCOUNTD` ON id_ACC1 = ID_ACC

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2022-02-25
@FanatPHP

in the first, weekends and holidays are clearly not taken into account, I did not understand the second "request" at all.
sql-ex.ru is quite alive and is not going to die.
I strongly recommend not only their problems but also the training course.
not to write such frank rubbish, but to produce SQL that at least remotely solves the task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question