Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'tail -f' a database table

Tags:

database

Is it possible to effectively tail a database table such that when a new row is added an application is immediately notified with the new row? Any database can be used.

like image 996
avid Avatar asked Apr 11 '11 17:04

avid


People also ask

How can I get last 10 rows of a table in SQL?

The following is the syntax to get the last 10 records from the table. Here, we have used LIMIT clause. SELECT * FROM ( SELECT * FROM yourTableName ORDER BY id DESC LIMIT 10 )Var1 ORDER BY id ASC; Let us now implement the above query.

How do I get the last 5 rows of a SQL table?

METHOD 1 : Using LIMIT clause in descending order As we know that LIMIT clause gives the no. of specified rows from specifies row. We will retrieve last 5 rows in descending order using LIMIT and ORDER BY clauses and finally make the resultant rows ascending.

What SQL retrieves data from table?

An SQL SELECT statement retrieves records from a database table according to clauses (for example, FROM and WHERE ) that specify criteria.

How do I find the first 10 records of my table?

To select first 10 elements from a database using SQL ORDER BY clause with LIMIT 10. Insert some records in the table using insert command. Display all records from the table using select statement. Here is the alternate query to select first 10 elements.


1 Answers

Use an ON INSERT trigger.

you will need to check for specifics on how to call external applications with the values contained in the inserted record, or you will write your 'application' as a SQL procedure and have it run inside the database.

it sounds like you will want to brush up on databases in general before you paint yourself into a corner with your command line approaches.

like image 54
Randy Avatar answered Oct 02 '22 08:10

Randy