MySQL Forums
Forum List  »  InnoDB

Re: Declare a table as like MS SQL Server
Posted by: Peter Brawley
Date: January 04, 2018 05:15PM

You inserted nulls for six of the eight p_nm values, so of course a query on the table returns what was inserted.

Note that since p_nm is varchar, values for it really ought to be quoted.

The stated requirement "227 data should repeat for previous record AND 121 data should repeat for previous records" cannot be reliably implemented because of a fundamental characteristic of relational databases: row content is independent of row order, row order is not a definably persistent table property; row order is defined only by Order By clauses in Select queries which address the table. You need to review relational database basics, (eg

If the table had a primary key, you could define a Trigger that sets p_nm column based on the PK, or you could create a View implementing that logic, or in 5.7 and later you could define a derived column using the same logic

Note also that with no primary key, the table isn't a real table.

What problem are you trying to solve by trying to make p_nm values depend on row order?

Options: ReplyQuote

Written By
January 03, 2018 11:35AM
January 03, 2018 01:02PM
January 04, 2018 11:49AM
January 04, 2018 01:03PM
Re: Declare a table as like MS SQL Server
January 04, 2018 05:15PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.