Rishi Rathor has Published 149 Articles

How to insert new cell into UITableView using Swift?

Rishi Rathor

Rishi Rathor

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

929 Views

To insert a new cell into UITableView we'll first have to create a table view cell and then add it to the table view using Cell for row at method of Table view.We can create a cell using Storyboard or by creating a nib of class UITableViewCell.In the View controller ... Read More

How to change the column position of MySQL table without losing column data?

Rishi Rathor

Rishi Rathor

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

9K+ Views

You can change the column position of MySQL table without losing data with the help of ALTER TABLE command. The syntax is as follows −ALTER TABLE yourTableName MODIFY yourColumnName1 data type AFTER yourColumnName2;To understand the above concept, let us create a table. The query to create a table with some ... Read More

Update column size in MySQL and increase its size?

Rishi Rathor

Rishi Rathor

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

325 Views

To update the column size, you can use alter command. The syntax is as follows −alter table yourTableName change yourColumnName yourColumnName data type;To understand the above syntax, let us create a table. The query to create a table −mysql> create table DataTruncated −> ( ... Read More

Do a select in MySQL based only on month and year?

Rishi Rathor

Rishi Rathor

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

1K+ Views

To select MySQL based on month and year, use in-built function YEAR() and MONTH(). The syntax is as follows −select *from yourTableName where YEAR(yourColumnName) = YearValue AND MONTH(yourColumnName) = monthValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create ... Read More

Get the difference between two timestamps in seconds in MySQL?

Rishi Rathor

Rishi Rathor

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

533 Views

To get difference between two timestamps in seconds, use two in-built functions TIME_TO_SEC() and TIMEDIFF() in MySQL. The syntax is as follows −select time_to_sec(timediff(yourCoulnName1, yourCoulnName2)) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a table.mysql> create table TimeToSecond ... Read More

Set column charset in MySQL?

Rishi Rathor

Rishi Rathor

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

456 Views

Set column charset using character SET command. The syntax is as follows −ALTER TABLE yourTableName MODIFY youColumName type CHARACTER SET anyCharcaterSetName;You can use character set name utf8 or something elsE. To set column charset, let us first create a table. The query to create a table is as follows −mysql> ... Read More

Display all tables inside a MySQL database using Java?

Rishi Rathor

Rishi Rathor

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

1K+ Views

We will see here how to display all tables inside a MySQL database using Java. You can use show command from MySQL to get all tables inside a MySQL database.Let’s say our database is ‘test’. The Java code is as follows to show all table names inside a database ‘test’.The ... Read More

MySQL add days to a date?

Rishi Rathor

Rishi Rathor

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

3K+ Views

To add days to a date, you can use DATE_ADD() function from MySQL. The syntax is as follows to add days to a date −INSERT INTO yourTableName VALUES(DATE_ADD(now(), interval n day));In the above syntax, you can use curdate() instead of now(). The curdate() will store only date while now() will ... Read More

How to display the value of a variable on command line in MySQL?

Rishi Rathor

Rishi Rathor

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

3K+ Views

To display the value of a variable, you can use select statement. The syntax is follows −SELECT @yourVariableName;Let us first create a variable. This can be done using SET command. The following is the syntax to create a variable −SET @yourVariableName = yourValue;Let us check the above syntax to create ... Read More

MySQL Query to change lower case to upper case?

Rishi Rathor

Rishi Rathor

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

8K+ Views

You can use in-built function UPPER() from MySQL to change a lower case to upper case. The syntax is as follows with select statement.SELECT UPPER(‘yourStringValue’);The following is an example showing string in lower case −mysql> select upper('john');Here is the output displaying string in upper case −+---------------+ | upper('john') | +---------------+ ... Read More

Advertisements