First of all, thank you very much for your answer!
I've seen the CTE concept in the Internet... it would make this a little bit easier... the problem is that PHPMyAdmin doesn't like the clause "WITH" and therefore I can't test it...
I'm thinking of storing the total price value into a new column of the invoice table and recalculate it after creating it or each time I modify it... It probably will be much faster when getting all the data and I can't see why it would be a bad design... but I'm super novice... Would it be something terrible?
And I'm curious... why would you look at the roundings?
I'm trying to avoid the need to do two queries while populating a table...
Would it be a bad design to add that totalInvoicePrice into the table tInvoices? that way at the moment of creating the invoice I would do what it's working now... and when I would need to get the data it would be extremely easy...
So I started my quest to learn Angular V6, and I have about a year into it now and doing quite well with it. I've made the move to Angular V7 and will go V8 pretty soon. I choose MongoDB for the database and I really like it, but have yet to do anything advanced with it. Well I just don't know the limitations of MongoDb since it's a NoSQL or document based database.
I'm going to add a store to my project so I can sell things. I've read the right way to do it is to use SQL Server for storing transactions because it's faster. Like run MongoDb to store product information and images, perhaps the cart; and use SQL Server to store the purchase transaction. But then their is FireBase and CosmoDB out there as well. I don't expect to sell much the first year, and I'm considering going Mongo all the way.
Just looking for opinions, help, guidance on this.
I really don't want to go back to SQL Server again.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
Well I just don't know the limitations of MongoDb since it's a NoSQL or document based database.
I've read the right way to do it is to use SQL Server for storing transactions because it's faster.
Faster in which case? Add a bunch of JOIN statements and heavy on index INSERT INTO queries and you will easily see how MongoDb performs better in most cases, and SQL Server slows down due to housekeeping.
The answer depends entirely on how you want to store the data, do you want to store the transactions as records and then pull out all from the tables one by one? Or do you want to have a single document of everything that a user has done in the system and be returned in a single go? I'll let you answer this.
With SQL Server—or any other relational database—your content is stored as a record, and you have to query the data using several JOIN clauses to prepare a single report. If you do not do this, then you are not following normalization techniques and are wasting money paid for relational features. In NoSQL—especially MongoDb, or other databases or same dialect—you store the data in a fashion that makes it easier to access, yes a bit slower on insert, but querying is better (this statement again of course can be debated upon).
FireBase and CosmoDB
Oh boy, don't read everything on the internet if you have to develop a product. Pick one and go with it!
I did it like this, and after spending some time with a couple of DBA's they couldn't improve on it:
;WITH cte AS
'.9.', '.09.') AS TREE
, cte2 AS
'.9.', '.09.') AS TREE
SELECT * FROM cte2;
Is there a better way?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I've assumed a table without a primary key; if your table has one, use that instead of the generated ROW_NUMBER:
WITH cteRN As
ROW_NUMBER() OVER (ORDERBY (SELECTNULL)) As RN,
SELECT'.' + IsNull(Format(Try_Parse(P.value Asint), 'D2'), P.value)
FROM cteRN As T2
CROSSAPPLY string_split(T2.tree, '.') As P
WHERE T2.RN = T.RN
FOR XML PATH(''), TYPE
, 1, 1, '') As tree
cteRN As T