have you any member who have good command in sql query?
Repeating sequentially for each company?
Other than those two is there a third option?
Why is the order important?
How many prices could be related to one company?
Or do you mean prices for each day?
What do you mean stock?
What problems with DB did you have?
Probably this field is extra in the GROUP BY : t4.s17
Please, ask the question
It’s a wrong place for such questions, really
We don’t do homeworks here.
send me the query
what u meaan
Table 1 has auto increment ID for symbol. Where I have trouble is inserting the prices into the second table. – Do you need to query the symbol table first to find the ID then..
insert into prices ‘1’,’$10′
Thanks
Table 1 has auto increment ID for symbol. Where I have trouble is inserting the prices into the second table. – Do you need to query the symbol table first to find the ID then..
insert into prices ‘1’,’$10′
Thanks
No you don’t need to query the first table.
There are two ways to get auto generated ids
— pseudo function mysql_insert_id()
— in the latest versions of myself, RETURNING clause of INSERT statement
Here is an article discussing this problem
https://dev.mysql.com/doc/refman/8.0/en/getting-unique-id.html
There are two ways to get auto generated ids
— pseudo function mysql_insert_id()
— in the latest versions of myself, RETURNING clause of INSERT statement
Here is an article discussing this problem
https://dev.mysql.com/doc/refman/8.0/en/getting-unique-id.html
Thanks! I look forward to reading that over dinner
There are two ways to get auto generated ids
— pseudo function mysql_insert_id()
— in the latest versions of myself, RETURNING clause of INSERT statement
Here is an article discussing this problem
https://dev.mysql.com/doc/refman/8.0/en/getting-unique-id.html
Thanks. After reading this… Does this mean that if you have one table Company with auto increment ID and another table which uses the the company_id as a primary key you should;
Insert one record into company table, then get the unique-id, then insert relevant rows into the prices table. Repeating sequentially for each company?
I have doubt
“Write a query to input values and returning the records corresponding to those values from the table”
Insert one record into company table, then get the unique-id, then insert relevant rows into the prices table. Repeating sequentially for each company?
Yes, kind of so
I have doubt
“Write a query to input values and returning the records corresponding to those values from the table”
What is your doubt?
Either that or you know what the order of the data in both tables should be along with the values of the primary and foreign keys and write out the whole SQL script before hand.
Other than those two is there a third option? …because you said “kind of”and not “yes”. Thanks in advance.
Other than those two is there a third option? …because you said “kind of”and not “yes”. Thanks in advance.
Why is the order important?
Other than those two is there a third option? …because you said “kind of”and not “yes”. Thanks in advance.
It was strict “yes”, sorry.
I added “kind of” because this is supposed to be your application and you in theory can do it like you want
I added “kind of” because this is supposed to be your application and you in theory can do it like you want
There are other possible ways of creation of master/details records, this is the most common
If you know the IDs ahead of time the order of insert statements is not important, just the matching company id values.
Can you describe what are some of the other ways…
If you know the IDs ahead of time the order of insert statements is not important, just the matching company id values.
Your application should not bother about concrete values of auto generated primary keys, it should not matter for the application what particular value is assigned for what company and in what order they are created
The main what I meant was loading pre-defined data , not using generation of IDs by the database
And yours inserts one record into the company table, then relevant records into the price table. And repeats this for each company record.
But I prefer your method to load predefined data.
And yours inserts one record into the company table, then relevant records into the price table. And repeats this for each company record.
But I prefer your method to load predefined data.
It is just sequential processing, that is all
And yours inserts one record into the company table, then relevant records into the price table. And repeats this for each company record.
But I prefer your method to load predefined data.
Pre-defined data means you already have all IDs and you don’t need Id generation from the DB
Longtext?
Tell us in details what is the problem you try to solve
Text and longtext are philosophically same
I want to store in two tables some basic stock market data for the ASX (Australian market). 1. List of company names, code and industry and 2. Daily Price data for each of 2500 odd companies.
The problem I was trying to solve is structuring those tables and how to go about getting the data in.
I think pre defined data is ideal (from web scraping). Then the auto id sequential method is another way to solve for it.
After that I need to consider structure of tables to perform analysis of the stocks prices against various criteria.
In the end state I could query: show me all the stocks that met all the 10 criteria last week. Etc
The problem I was trying to solve is structuring those tables and how to go about getting the data in.
I think pre defined data is ideal (from web scraping). Then the auto id sequential method is another way to solve for it.
After that I need to consider structure of tables to perform analysis of the stocks prices against various criteria.
In the end state I could query: show me all the stocks that met all the 10 criteria last week. Etc
How many prices could be related to one company?
What do you mean stock?