Samual Sam

Samual Sam

1,507 Articles Published

Articles by Samual Sam

Page 135 of 151

MySQL If statement with multiple conditions?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 8K+ Views

You can use if statement in a stored procedure with multiple conditions with the help of AND or OR operator. The syntax is as follows −DECLARE X int; DECLARE Y int; SET X = value1; SET Y = value2; IF ( (X < Y AND X > value1 AND Y >value2) OR X! = anyValueToCompare) THEN    yourStatement; ELSE    yourStatement; END IFNow to understand the above syntax, let us create a stored procedure. The query to create a stored procedure is as follows −mysql> create procedure SP_IFELSEDEMO()    -> BEGIN    -> DECLARE X int;    -> DECLARE Y ...

Read More

Is there any JSTL library to parse XML in a JSP?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 273 Views

The JSTL XML tags provide a JSP-centric way of creating and manipulating the XML documents. Following is the syntax to include the JSTL XML library in your JSP.The JSTL XML tag library has custom tags for interacting with the XML data. This includes parsing the XML, transforming the XML data, and the flow control based on the XPath expressions.Before you proceed with the examples, you will need to copy the following two XML and XPath related libraries into your \lib −XercesImpl.jar − Download it from https://www.apache.org/dist/xerces/j/xalan.jar − Download it from https://xml.apache.org/xalan-j/index.html

Read More

What is extends attribute in JSP?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 901 Views

The extends attribute specifies a superclass that the generated servlet must extend.For example, the following directive directs the JSP translator to generate the servlet such that the servlet extends somePackage.SomeClass −

Read More

Does it make sense to use "LIMIT 1" in a query "SELECT 1 ..."?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 885 Views

Yes, you can use LIMIT 1 with SELECT1.Suppose, you are using SELECT 1 and your table has billions of records. In this case, it will print 1 billion times.The syntax of SELECT 1 is as follows −SELECT 1 FROM yourTableName;Suppose, you are using LIMIT 1 and your table has billions of records. This case, it will print 1 only once.The syntax of SELECT 1 with LIMIT 1 is as follows −SELECT 1 FROM yourTableName LIMIT 1;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Select1AndLimit1Demo    -> ...

Read More

What is info attribute in JSP?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 414 Views

The info attribute lets you provide a description of the JSP. The following is a coding example −

Read More

Select query using MySQL IN() and avoid sorting in it

Samual Sam
Samual Sam
Updated on 30-Jul-2019 367 Views

Using IN() sorts the result for the specific field. To avoid this, use ORDER BY and FIND_IN_SET() for the field.To understand the find_in_set(), let us create a table. The query to create a table is as follows −mysql> create table ProductStock    -> (    -> ProductId int,    -> ProductName varchar(20),    -> ProductQuantity int,    -> ProductPrice float    -> ); Query OK, 0 rows affected (0.79 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into ProductStock values(1, 'Product-101', 10, 500.56); Query OK, 1 row affected (0.20 ...

Read More

What is language attribute in JSP?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 541 Views

The language attribute indicates the programming language used in scripting the JSP page.For example, because you usually use Java as the scripting language, your language option looks like this −

Read More

What is isELIgnored Attribute in JSP?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 7K+ Views

The isELIgnored attribute gives you the ability to disable the evaluation of Expression Language (EL) expressions which has been introduced in JSP 2.0.The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.Following directive sets an expression not to be evaluated −

Read More

Check replication type in MySQL?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 495 Views

To check replication type, you can use SHOW GLOBAL VARIABLES command. The syntax is as follows −SHOW GLOBAL VARIABLES LIKE 'binlog_format';The above syntax returns either ROW, MIXED or STATEMENT. The default resultant is ROW.Now you can implement the above syntax to check replication type. The query is as follows −mysql> SHOW GLOBAL VARIABLES LIKE 'binlog_format';Here is the output −+---------------+-------+ | Variable_name | Value | +---------------+-------+ | binlog_format | ROW | +---------------+-------+ 1 row in set (0.10 sec)Here is the query to switch from ROW to STATEMENT −mysql> SET GLOBAL binlog_format = 'STATEMENT'; Query OK, 0 rows affected (0.04 ...

Read More

Extract tuples with specified common values in another column in MySQL?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 520 Views

To extract tuples with specified common values, use the following syntax −SELECT DISTINCT aliasName.yourColumnName1, aliasName.yourColumnName2, aliasName1.yourColumnName 1, aliasName1.yourColumnName2 FROM yourTableName aliasName INNER JOIN yourTableName aliasName1 ON aliasName.yourColumnName1 = aliasName1.yourColumnName1 WHERE aliasName.yourColumnName2 = 'value1' AND aliasName1.yourColumnName2 = 'value2';To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table extractTuples    -> (    -> Id int,    -> Name varchar(20),    -> Comments text    -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into ...

Read More
Showing 1341–1350 of 1,507 articles
« Prev 1 133 134 135 136 137 151 Next »
Advertisements