Rama Giri has Published 110 Articles

How can we update values in a MySQL table?

Rama Giri

Rama Giri

Updated on 30-Jan-2020 06:00:27

461 Views

With the help of UPDATE statement and WHERE clause, we can update the values in single or multiple rows of the table. MySQL updates the values on the basis of condition specified in WHERE clause. For example, suppose in the ‘employee’ table we want to change the ‘name’ and ‘doj’ ... Read More

Is there a naming convention for tables in MySQL?

Rama Giri

Rama Giri

Updated on 28-Jan-2020 12:22:05

484 Views

No, MySQL does not have a preferred naming convention standard. If the name we have chosen is logical and consistent then it would be ok.Two major points need to be remembered, one is that no two tales/databases can have the same name and second we can choose any of the ... Read More

Adding a condition using SQL or an ABAP program and difference in performance

Rama Giri

Rama Giri

Updated on 28-Jan-2020 05:36:38

187 Views

As there are just 500, there would not be much difference among both options. You can use either of them.The ABAP code is as below −LOOP AT lt_table TRANSPORTING NO FIELDS WHERE exp > 5    ADD 1 TO lt_counter ENDLOOP

Match any single character outside the given set.

Rama Giri

Rama Giri

Updated on 20-Jan-2020 10:59:37

72 Views

To match any single character outside the given set with JavaScript RegExp, use the [^aeiou] metacharacter.Example           JavaScript Regular Expression                        var myStr = "Welcome!";          var reg = /[^lc]/g;          var match = myStr.match(reg);                   document.write(match);          

Getting details when a table is modified in SAP HANA DB

Rama Giri

Rama Giri

Updated on 05-Dec-2019 07:45:45

1K+ Views

You can query SYS.M_TABLE_STATISTICS providing name of table and LAST MODIFY DATE. Here is the sample SQL query.SELECT "ABC", "LAST_MODIFY_TIME"   FROMSYS.M_TABLE_STATISTICS ORDER BY “LAST_MODIFY_TIME" DESCIn above command, you need to replace “ABC” by your table name.

How to find all pairs of elements in Java array whose sum is equal to a given number?

Rama Giri

Rama Giri

Updated on 02-Aug-2019 14:05:01

6K+ Views

To find all pairs of elements in Java array whose sum is equal to a given number −Add each element in the array to all the remaining elements (except itself).Verify if the sum is equal to the required number.If true, print their indices.Exampleimport java.util.Arrays; import java.util.Scanner; public class sample { ... Read More

MySQL query to get the highest value from a single row with multiple columns

Rama Giri

Rama Giri

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

142 Views

To get the highest value, use the GREATEST() method. Let us first create a table −mysql> create table DemoTable    -> (    -> Value1 int,    -> Value2 int,    -> Value3 int    -> ); Query OK, 0 rows affected (1.29 sec)Insert some records in the table using ... Read More

How to check if a datetime value equals tomorrows date in MySQL?

Rama Giri

Rama Giri

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

197 Views

For this, you can use DATEDIFF(). Let us first create a table −mysql> create table DemoTable -> ( -> ShippingDate datetime -> ); Query OK, 0 rows affected (0.90 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

MySQL query to delete all rows older than 30 days?

Rama Giri

Rama Giri

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

17K+ Views

To delete all rows older than 30 days, you need to use the DELETE with INTERVAL. Use < now() i.e. less than operator to get all the records before the current date.Let us first create a table −mysql> create table DemoTable    -> (    -> UserMessage text,    -> ... Read More

Count the number of distinct values in MySQL?

Rama Giri

Rama Giri

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

160 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> Name varchar(100),    -> Code varchar(100)    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', '0001'); Query OK, 1 row affected ... Read More

Previous 1 ... 3 4 5 6 7 ... 11 Next
Advertisements