Lakshmi Srinivas

Lakshmi Srinivas

233 Articles Published

Articles by Lakshmi Srinivas

Page 19 of 24

What would be the output of MySQL SUM() function if a column having no values has been passed as its argument?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 07-Feb-2020 163 Views

When MySQL SUM() function got a column, having no values, as an argument then it will return NULL, rather than 0, as output. The column can be of any data type. Following the example, using a table named ‘social’ having only one column named ‘id’ with no values, will illustrate itExamplemysql> Describe Social; +-------+-------------+------+-----+---------+-------+ | Field | Type        | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | Id    | int(11)     | YES  |     |   NULL  |       | | Name  | varchar(20) | YES  |     ...

Read More

How can we use MySQL LPAD() and RPAD() functions in the same query for padding the string to both sides, left and right, of the original string?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 06-Feb-2020 871 Views

For achieving this, we must have to use one of the functions as the 1st argument of the other function. In other words, either RPAD() function would be the 1st argument of LPAD() function or LPAD() function would be the 1st argument of RPAD() function. It can be understood with the help of the following exampleExamplemysql> Select RPAD(LPAD(' My name is Ram ', 23, '* '), 30, '* '); +------------------------------------------------+ | RPAD(LPAD(' My name is Ram ', 23, '* '), 30, '* ') | +------------------------------------------------+ | * * * * My name is Ram * * * *     ...

Read More

What is the difference between MySQL INSTR() and FIND_IN_SET() functions?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 04-Feb-2020 606 Views

As we know, both the functions are used to search a string from the arguments provided in them but there are some significant differences between them as followsFIND_IN_SET() function uses the string list that is itself a string containing the substring separated by commas. Whereas, INSTR() function contains a string from which it will find the position of the first occurrence of the substring if present. In case of integers, FIND_IN_SET() is much more suitable than INSTR() function. It can be understood by the following exampleExamplemysql> Select IF(INSTR('10, 11, 12, 13', 2) > 0, 1, 0) As Result; +--------+ | Result ...

Read More

How can we specify default values in MySQL INSERT statement?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 30-Jan-2020 2K+ Views

At the time of creation of a table, if any column is defined with default values then by using the keyword ‘DEFAULT’ in the INSERT statement, we can take default value for that column. For example, we have created a table ‘employee’ with a default value of column ‘DOJ’ as follows −mysql> Create table employee(id int, name varchar(20), doj date DEFAULT '2005-01-01'); Query OK, 0 rows affected (0.09 sec) mysql> Insert into employee(id, name, doj) values(1, ’Aarav’, DEFAULT); Query OK, 1 row affected (0.03 sec) mysql> select * from employee; +------+------------+---------------+ | id   | name     ...

Read More

How to sort MySQL output on the basis of the column which is not in the result set?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 30-Jan-2020 225 Views

It is quite possible to get the sorted output on the basis of the column which is not even the part of that output or not in the result set. It can be done by selecting the required fields and writing the name of the fields on the basis of which sorting order is desired. Following is an example to demonstrate it, in which we sorted out the result set, having ‘Name’ and ‘Address’ fields, on the basis of column ‘id’.mysql> Select Name, Subject From Student ORDER BY Id; +---------+-----------+ | Name    | Subject   | +---------+-----------+ | Gaurav ...

Read More

What MySQL returns when we remove all the columns from a table by using ALTER TABLE command with DROP keyword?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 29-Jan-2020 286 Views

Eventually, we cannot remove all the columns from a table by using ALTER TABLE command with DROP keyword. In this case, MySQL will return an error message. It is demonstrated with the help of the following exampleSuppose in table ‘Employee’ we have two columns ‘name’ and ‘id’, now if we will use ALTER TABLE to remove both the columns then MySQL returns an error as followsmysql> ALTER TABLE employee drop column name, drop column id; ERROR 1090 (42000): You can't delete all columns with ALTER TABLE; use DROP TABLE instead

Read More

How to add elements to the midpoint of an array in Java?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 19-Dec-2019 296 Views

Apache commons provides a library named org.apache.commons.lang3 and, following is the maven dependency to add library to your project.           org.apache.commons       commons-lang3       3.0     This package provides a class named ArrayUtils. You can add an element at a particular position in an array using the add() method of this class.Exampleimport java.util.Arrays; import org.apache.commons.lang3.ArrayUtils; public class AddingElementToMidPoint {    public static void main(String args[]) {       int[] myArray = {23, 93, 30, 56, 92, 39};       int eleToAdd = 40;       int position= myArray.length/2;       int [] result = ArrayUtils.add(myArray, position, eleToAdd);       System.out.println(Arrays.toString(result));    } }Output[23, 93, 30, 40, 56, 92, 39]

Read More

Finding location of uploaded file using SAP GUI_upload

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 16-Dec-2019 885 Views

When you upload a file using the gui_upload function, the file is not uploaded to the Application server. The file is read from presentation layer to an internal table.ExampleFollowing code can be used to call a gui_upload function to read the file to an internet table:lv_filename = p_filebp. CLEAR lt_data_tab. IF NOT lv_filename IS INITIAL.   CALL FUNCTION 'GUI_UPLOAD'     EXPORTING       filename = lv_filename     TABLES       data_tab = lt_data_tab     EXCEPTIONS       file_open_error = 1       OTHERS = 17.   IF sy-subrc 0.     EXIT. ...

Read More

Difference between SAP ECC system and SAP BW system?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 11-Dec-2019 4K+ Views

SAP ECC stands for SAP ERP Central Component (ECC). It is a standout amongst the most perceived resources that SAP has developed. It is an ERP software which comprises in a few modules that give the association’s awesome control over their key business forms.Various modules can speak with each other to make a completely coordinated application particular to any client inside an extensive variety of industry areas. It can be customized to serve the individual needs as well.SAP ECC executions are a major test for any client due to the hazard that speaks to changing the way they oversee fundamental ...

Read More

Explain the module function to split ABAP date?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 11-Dec-2019 435 Views

You can use module function name “MONTH_NAMES_GET” to get the month’s name. The function will take up the language as a parameter; you can pass the desired language as a parameter and get the month’s name. Similarly, we have a function for fetching day name as well. You can use:“RH_GET_DATE_DAYNAME”

Read More
Showing 181–190 of 233 articles
« Prev 1 17 18 19 20 21 24 Next »
Advertisements