We will first order by DESC and then fetch the value associated with maximum id −select *from yourTableName order by yourColumnName DESC LIMIT 1, 1;Let us first create a table −mysql> create table DemoTable -> ( -> Alldata int -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(303); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(560); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.13 sec) mysql> insert ... Read More
The HTML DOM History length property returns of URLs in the History list of current window.SyntaxFollowing is the syntax −history.lengthExampleLet us see an example of HTML DOM History length property − Live Demo body{ text-align:center; } .btn{ background-color:lightblue; border:none; height:2rem; border-radius:50px; width:60%; margin:1rem auto; } .show{ font-size:2rem; font-weight:bold; color:orange; } History length Property Example Click me to get History length function getHistoryLength(){ var historyLength=history.length; document.querySelector(".show").innerHTML = historyLength; } OutputThis will produce the following output −Click on the “blue” button to see the history length of current browser window.
The HTML DOM Label htmlFor property returns/sets the value of for attribute.SyntaxFollowing is the syntax −Returning value of for attribute −labelObject.htmlForExampleLet us see an example for Label htmlForproperty − Live Demo Label htmlFor form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } Label-htmlFor Current Editor: Label for attribute set as editor two ... Read More
This C++ program displays the solution to the Tower of Hanoi problem using binary value.There is one binary digit for each disk.The most significant bit represents the largest disk. A value of 0 indicates that the largest disk is on the initial peg, while a 1 indicates that it’s on the final peg.The bitstring is read from left to right, and each bit can be used to determine the location of the corresponding disk.The corresponding disk is stacked on top the previous disk on the same peg if a bit has the same value as the previous one.If it is ... Read More
When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The updateRow() method of the ResultSet interface updates the contents of the current row to the database. For example if we have updated the values of a particular record using the updateXXX() ... Read More
Multiple Access with Collision Avoidance (MACA) is a medium access control (MAC) layer protocol used in wireless networks, with a view to solve the hidden terminal problem. It also provides solution to the exposed terminal problem. The MAC layer protocol IEEE 802.11 RTS/CTS has been adopted from MACA.Working PrincipleThe MACA protocol works with the condition that the stations are synchronized and frame sizes and data speed are the same. It involves transmission of two frames called RTS and CTS prior to data transmission. RTS stands for Request to Send and CTS stands for Clear to Send.Let us consider that a ... Read More
To center a Window in Java, use the getCenterPoint() method. Set the width and height and use the below formulae to set bounds −Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); int width = 500; int height = 200; frame.setBounds(center.x - width / 2, center.y - height / 2, width, height);The following is an example to center a window −Examplepackage my; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Register!"); ... Read More
Let us first create a table −mysql> create table DemoTable -> ( -> Words text -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Ever'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Forever'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Good'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Never'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+---------+ | Words ... Read More
The HTML Object represents the element of an HTML document.Let us see how to access HTML object −SyntaxFollowing is the syntax −document.getElementsByTagName(“HTML”)Let us see an example of HTML object −Example Live Demo body{ text-align:center; } .btn{ background-color:lightblue; border:none; height:2rem; border-radius:50px; width:60%; margin:1rem auto; } .show{ font-size:1rem; font-weight:bold; color:orange; border:2px solid green; padding:10px; display:none; } ... Read More
The HTML DOM Label Object in HTML represents the element.SyntaxFollowing is the syntax −Creating a elementvar labelObject = document.createElement(“LABEL”)PropertiesHere, “LabelObject” can have the following properties −PropertyDescriptionControlIt returns the control of the labelformIt returns a reference of enclosing form that contains the labelhtmlForIt returns/sets the value of the for attribute of a labelExampleLet us see an example for Label htmlForproperty − Live Demo Label htmlFor form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP