Decrease Record Value to Zero in MySQL

Anvi Jain
Updated on 30-Jul-2019 22:30:26

187 Views

Use SET to decrease the value and WHERE to set the condition for a specific record to be 0. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Number int ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command &minusmysql> insert into DemoTable(Number) values(10); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Number) values(20); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(Number) values(1); Query OK, 1 row affected ... Read More

Define Min and Max Value for EditText in Android

Chandu yadav
Updated on 30-Jul-2019 22:30:26

3K+ Views

This example demonstrate about How to define a MIN and MAX value for EditText in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.java     Step 3 − Add the following code to src/MinMaxFilter.javapackage app.tutorialspoint.com.sample ; import android.text.InputFilter ; import android.text.Spanned ; public class MinMaxFilter implements InputFilter {    private int mIntMin , mIntMax ;    public MinMaxFilter ( int minValue , int maxValue) {       this . mIntMin = minValue ... Read More

MongoDB Query to Find Documents with Two Values in an Array

Smita Kapse
Updated on 30-Jul-2019 22:30:26

354 Views

For this, use $elemMatch operator. Let us first create a collection with documents −> db.findDocumentsHaving2Demo.insertOne(    {_id : 101, Values: [78, 98]} ); { "acknowledged" : true, "insertedId" : 101 } > db.findDocumentsHaving2Demo.insertOne(    {_id :102, Values : [89, 102]} ); { "acknowledged" : true, "insertedId" : 102 }Following is the query to display all documents from a collection with the help of find() method −> db.findDocumentsHaving2Demo.find().pretty();This will produce the following output −{ "_id" : 101, "Values" : [ 78, 98 ] } { "_id" : 102, "Values" : [ 89, 102 ] }Following is the query to find documents ... Read More

Use INSERT INTO SELECT in MySQL to Avoid Error 1064

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

697 Views

Let us first create a table −mysql> create table DemoTable1    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstName varchar(100)    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1(FirstName) values('John'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1(FirstName) values('Chris'); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output −+----+-----------+ | Id | FirstName | +----+-----------+ | 1 | John ... Read More

Difference Between Selenium RC and WebDriver

Adiya Dua
Updated on 30-Jul-2019 22:30:26

615 Views

Selenium RC(Remote Control) and Web Driver differ in many aspects but the key difference comes in the implementation layer or in simple words the architecture of both of them.As name suggest, RC is a Remote Control which works by taking the remote of the browser and then injects the automation code to be tested by injecting the custom scripts written. Whereas the Web Driver works on the browser directly and uses browsers in-built features to trigger the automation test written by tester. Web driver is the successor of Remote Control.Both the frameworks have common features which include use of programming ... Read More

Max Function for Rows in MySQL

George John
Updated on 30-Jul-2019 22:30:26

167 Views

Yes, you can use GREATEST() from MySQL to check maximum from rows (not columns). Let us first create a table −mysql> create table DemoTable    (    Value1 int,    Value2 int,    Value3 int    ); Query OK, 0 rows affected (0.58 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(190, 395, 322); Query OK, 1 row affected (0.16 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output−+--------+--------+--------+ | Value1 | Value2 | Value3 | +--------+--------+--------+ | 190 | 395 ... Read More

Close JFrame on Button Click in Java

Samual Sam
Updated on 30-Jul-2019 22:30:26

13K+ Views

Set frame.dispose() on the click of a button to close JFrame. At first create a button and frame −JFrame frame = new JFrame(); JButton button = new JButton("Click to Close!");Now, close the JFrame on the click of the above button with Action Listener −button.addActionListener(e -> {    frame.dispose(); });The following is an example to close JFrame on the click of a Button −Exampleimport java.awt.Color; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       JButton button = new JButton("Click to Close!");   ... Read More

Update Array Element in MongoDB Using Push

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

455 Views

Let us first create a collection with documents −> db.updateArrayElementDemo.insertOne(    {       "UserDetails":       [          {             "UserName":"Chris",             "UserAge":23          }       ]    } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce9029378f00858fb12e90d") }Following is the query to display all documents from a collection with the help of find() method −> db.updateArrayElementDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5ce9029378f00858fb12e90d"),    "UserDetails" : [       {       ... Read More

Grant User Access to All Stored Procedures in MySQL

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

1K+ Views

Let us first display all users and host from the table MySQL.user −mysql> select user, host from Mysql.user;This will produce the following output −+------------------+-----------+ | user             | host      | +------------------+-----------+ | Bob              | %         | | Charlie          | %         | | Robert           | %         | | User2 | % ... Read More

HTML DOM Input URL Value Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

160 Views

The HTML DOM Input URL value property returns a string if value attribute is defined of input URL. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputURLObject.valueSetting value attribute to a string valueinputURLObject.value = ‘String’ExampleLet us see an example for Input URL value property − Live Demo Input URL value    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;   ... Read More

Advertisements