Swarali Sree

Swarali Sree

48 Articles Published

Articles by Swarali Sree

Page 3 of 5

How can I use MySQL INTERVAL() function with a column of a table?

Swarali Sree
Swarali Sree
Updated on 22-Jun-2020 503 Views

We can use INTERVAL() function with a column of a table by providing the first argument as the name of the column. In this case, al the values in that column would be compared with the values given as the other arguments of INTERVAL() function and on that basis of comparison, the result set is provided. To understand it, the data from the employee table is used which is as follows −mysql> Select* from employee568; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | ...

Read More

In MySQL, how can we insert a substring at the specified position in a string?

Swarali Sree
Swarali Sree
Updated on 22-Jun-2020 718 Views

We can use a MySQL INSERT() function to insert a substring at the specified position in a string.SyntaxINSERT(original_string, @pos, @len, new_string)Here, original_string is the string in which we want to insert a new string at the place of some specific number of characters.@pos is the position at which the insertion of the new string should start.@len is the number of characters that should delete from the original string. The starting point of the deletion of characters is the value of @pos.New_string is the string we want to insert into the original string.Examplemysql> Select INSERT('MySQL Tutorial', 7, 8, '@Tutorialspoint'); +------------------------------------------------+ | ...

Read More

How can we find the index position of a string stored as a record in MySQL table's column?

Swarali Sree
Swarali Sree
Updated on 22-Jun-2020 216 Views

We can use FIELD() function to find the index position of a string stored as a record in MySQL table’s column. To demonstrate it we are using the table named ‘websites’ having the following dataExamplemysql> Select * from websites; +----+---------------+------------------------+ | Id | Purpose       | Webaddress             | +----+---------------+------------------------+ | 1  | For tutorials | www.tutorialspoint.com | | 2  | For searching | www.google.co.in       | | 3  | For email     | www.gmail.com          | +----+---------------+------------------------+ 3 rows in set (0.00 sec)Now, suppose if we ...

Read More

How can I insert a value in a column at the place of NULL using MySQL COALESCE() function?

Swarali Sree
Swarali Sree
Updated on 20-Jun-2020 894 Views

To understand it, we are using the data from the table ‘Employee’ having Salary=NULL for ID = 5 and 6, as follows −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | | 5  | Ram    | NULL   | | 6  | Mohan  | NULL   | +----+--------+--------+ 6 rows in set (0.00 sec)Now, the following queries will use COALESCE() function along with UPDATE and ...

Read More

When MySQL FIND_IN_SET() function returns NULL as output?

Swarali Sree
Swarali Sree
Updated on 20-Jun-2020 387 Views

FIND_IN_SET() function returns NULL as output if any of the argument i.e. either search string or string list, is NULL. Of course, It will also return NULL if both of the arguments are NULL.Examplemysql> Select FIND_IN_SET(NULL,'Ram is a good boy') AS Result; +--------+ | Result | +--------+ | NULL   | +--------+ 1 row in set (0.00 sec) mysql> SELECT FIND_IN_SET('RAM',NULL)AS RESULT; +--------+ | RESULT | +--------+ | NULL   | +--------+ 1 row in set (0.00 sec) mysql> SELECT FIND_IN_SET(NULL,NULL); +------------------------+ | FIND_IN_SET(NULL,NULL) | +------------------------+ |                   NULL | +------------------------+ 1 row in set (0.00 sec)

Read More

How can we use existing values of the rows to provide new values in the SET clause of UPDATE statement?

Swarali Sree
Swarali Sree
Updated on 20-Jun-2020 240 Views

Existing values of the row can be used to provide new values in the SET clause if that row matches the WHERE clause in an UPDATE statement. Following is the example to demonstrate it.ExampleSuppose we have a table named ‘tender’ as follows −mysql> Select * from tender; +-----------+---------+------+ | tender_id | company | rate | +-----------+---------+------+ | 200       | ABC     | 1000 | | 300       | ABD     | 6000 | | 301       | ABE     | 7000 | | 302       | ABF   ...

Read More

What happens if I will add a UNIQUE constraint on the same column for multiple times?

Swarali Sree
Swarali Sree
Updated on 19-Jun-2020 662 Views

When we will add a UNIQUE constraint on the same column multiple times then MySQL will create the index on that column for a number of times we have added the UNIQUE constraint.ExampleSuppose we have the table ‘employee’ in which we have the UNIQUE constraint on ‘empid’ column. It can be checked form the following query −mysql> Describe employee; +------------+-------------+------+-----+---------+-------+ | Field      | Type        | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+-------+ | empid      | int(11)     | YES  | UNI | NULL    |       | | ...

Read More

How can we apply UNIQUE constraint to the field of an existing MySQL table?

Swarali Sree
Swarali Sree
Updated on 19-Jun-2020 612 Views

We can apply the UNIQUE constraint to a column of an existing MySQL table with the help of ALTER TABLE statement.SyntaxALTER TABLE table_name MODIFY colum_name datatype UNIQUE;                     OR ALTER TABLE table_name ADD UNIQUE (colum_name);ExampleSuppose we have the following table named ‘Test4’ and we want to add UNIQUE constraint to the column ‘Name’ then it can be done with the help of ALTER TABLE command as follows −mysql> DESCRIBE test4; +-------+-------------+------+-----+---------+-------+ | Field | Type        | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | ID   ...

Read More

Is it required a configuration in SAP SM59?

Swarali Sree
Swarali Sree
Updated on 15-Jun-2020 472 Views

If you are only calling a Remote Function Module in SAP system, you don’t require any configuration in SM59.Considering a scenario where your SAP system has to call a function in the C# application, then you need to configure RFC destination using SM59. You can Transaction for defining HTTP destinations- SM59.There are two types of HTTP connection:HTTP connection to an external server (connection type G)HTTP connection to an ABAP system (connection type H) Note that both the connection types differ from each other in terms of logon procedures. The technical settings are same for both connections.

Read More

What happens to the current MySQL transaction if the session is killed by DBA?

Swarali Sree
Swarali Sree
Updated on 27-Feb-2020 795 Views

Suppose if a session is killed in the middle of a transaction then that current MySQL transaction will be rolled back by MySQL and ended. It means that all the database changes made in the current transaction will be removed. It is called n implicit rollback when the session is killed.ExampleSuppose we have the following values in the table ‘marks’mysql> Select * from marks; +------+---------+-----------+-------+ | Id   | Name    | Subject   | Marks | +------+---------+-----------+-------+ |    1 | Aarav   | Maths     |    50 | |    1 | Harshit | Maths   ...

Read More
Showing 21–30 of 48 articles
Advertisements