Inserted, Deleted Tables (Magic Tables) in MySQL

11,311

They are called NEW and OLD in MySQL.

NEW is the new record to be inserted or the updated data.

OLD is the deleted record, or the old data before an update.

See the documentation for creating a trigger here: http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html

Share:
11,311
Dr. Rajesh Rolen
Author by

Dr. Rajesh Rolen

Over 15 years of successful experience in development of multi-tier applications and system integration solutions as application architect, project leader, technical lead, and software engineer. Very good understanding of application analysis and design concepts. Strong ability to apply proven design patterns to the system design and employ extreme programming and SCRUM techniques to the robust implementations. PhD (Computer Science & Engineering), MCA, BCA, MCTS, MCP, SCJP. Experience of working in the complete Software development life cycle involving SRS, Software architecture design, database design, Code Reviews, development, and documentation. Capable to delve into the new leading Technologies. Ability to work well in both a team environment and individual environment. Ability to train the team. Areas of Expertise Strong in Architecture design, Design Principles, Design Patterns and OOPs concepts. Capable of developing cross-platform code and managing project. Web applications and web services development using ASP.NET MVC with C#.NET/ VB.NET. Client-Server based applications developed using C#.NET and VB.NET Strong in Business requirement analysis and functional specification design and documentation. Through knowledge of Object Oriented Analysis and Design OOAD and N - Tier Architecture Strong in front-end GUI development using ASP.Net, HTML, JavaScript, JQuery. Strong in backend database development including designing and administering databases, - writing stored procedures, SQL and triggers for SQL Server, Oracle, and My-SQL databases. Strong Analytical Skills. Strong oral and written communication skills Download CV

Updated on June 18, 2022

Comments

  • Dr. Rajesh Rolen
    Dr. Rajesh Rolen about 2 years

    I am regular user of MS-SQL but now working on a project which has mysql as a back-end.

    Please tell me that is there exists such a inserted/Deleted tables (Magic tables) in mysql which I can use inside trigger or in normal queries.

  • Dr. Rajesh Rolen
    Dr. Rajesh Rolen about 13 years
    can we use it for normal queries too as we can use inserted/deleted using "output" in MS-SQL Server 2005/2008?
  • Fosco
    Fosco about 13 years
    @Rajesh I looked around and was unable to find an analogous method to the OUTPUT clause in MSSQL.
  • Johan
    Johan about 13 years
    @Rajesh, the new/old virtual tables only exist within triggers. You cannot use them in normal queries. You can however save your deleted rows to a table of your choosing inside the trigger.