Order By Selected Record in MySQL

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

175 Views

You can use a CASE statement for this. Let us first create a table −mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.71 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(490); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable values(310); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(540); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(123); Query OK, 1 row affected (0.60 sec) mysql> insert into DemoTable values(1230); Query OK, 1 row affected (0.15 sec) mysql> ... Read More

Get Maximum Schema Name Length in Java Database Metadata

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

59 Views

The getMaxSchemaNameLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows in the name of a schema.This method returns an integer value, representing the maximum number of characters allowed in a schema name. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() ... Read More

MySQL Query to Display Ascending Order in Number Column

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

317 Views

You can achieve this with the help of CAST() function. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Score int    ); Query OK,  0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Score) values(10); Query OK,  1 row affected (0.19 sec) mysql> insert into DemoTable(Score) values(100); Query OK,  1 row affected (0.14 sec) mysql> insert into DemoTable(Score) values(11); Query OK,  1 row affected (0.13 sec) mysql> insert into DemoTable(Score) values(97); Query OK,  1 row affected (0.14 sec) mysql> insert into DemoTable(Score) values(78); Query OK,  1 row affected (0.13 sec) mysql> insert into DemoTable(Score) values(89); Query OK,  1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----+-------+ | Id | Score | +----+-------+ | 1 | 10 | ... Read More

Perform On/Off Desired Output for LEDs on 8085

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

5K+ Views

Here we will see how to interface PORT IC with 8085.Problem StatementON/OFF desired output LEDs connected at the output port B.DiscussionHere we will see how to On/Off LEDs at port B. We are using 8255 IC for ports. The J1 and J2 connectors to connect the 8085 and 8255. The connector pin descriptions are given below. For controlling pin, we have to set the control word, that will be used in the program.Pin no. on J1/J28255 PinFunction113PC4212PC5316PC2417PC3514PC0615PC1724PB6825PB7922PB41023PB51120PB21221PB31318PB01419PB11538PA61637PA71740PA41839PA5192PA2201PA3214PA0223PA12311PC62410PC72526+5V267GND  Group A and B will operate in mode 0.Using port A as input port and port B as output port. The operation mode of ... Read More

Place Thousand Separator in MySQL Records

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

2K+ Views

Use the FORMAT() method for this. Let us first create a table −mysql> create table DemoTable    -> (    -> Amount DECIMAL(10, 2)    -> ); Query OK, 0 rows affected (0.45 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(84848757.60); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(95868685.50); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(4242342.36); Query OK, 1 row affected (0.21 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+-------------+ | Amount      | +-------------+ | 84848757.60 ... Read More

Display Current Date and Time in an iOS Application

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

268 Views

Playing with date and time is very important in any programming language, it becomes more important if you’re developing mobile application.Numerous application such as weather, forecast, gaming and so on uses date and time. In this we will be seeing how we can get the current date and time.To get the current date and time we will be using timeIntervalSince1970 instance property, you can read about it https://developer.apple.com/documentation/foundation/nsdate/1407504-timeintervalsince1970So copy the below code in your viewDidLoad method and run the application, we will be printing the current date and time, and based on requirement we can print the same in UILabel ... Read More

HTML DOM Input Datetime Type Property

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

441 Views

The HTML DOM Input Datetime type property returns/sets type of Input Datetime.SyntaxFollowing is the syntax −Returning string valueinputDatetimeObject.typeSetting type to string valueinputDatetimeObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsdateIt defines that input type is datedatetimeIt defines that input type is datetimecheckboxIt defines that input type is checkboxtextIt defines that input type is textExampleLet us see an example of Input Datetime type property − Live Demo Input Datetime type Date of Birth: Get Time and Date    var divDisplay = document.getElementById("divDisplay");    var inputDatetime = document.getElementById("datetimeSelect");    divDisplay.textContent = ... Read More

Update All Dates in a Table

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

162 Views

You can use UPDATE with DATE_ADD() to update all dates. Let us first create a table −mysql> create table DemoTable    (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientProjectDueDate date    ); Query OK, 0 rows affected (1.19 sec)Insert records in the table using insert command −mysql> insert into DemoTable(ClientProjectDueDate) values('2018-01-21'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(ClientProjectDueDate) values('2019-03-25'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(ClientProjectDueDate) values('2013-11-01'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(ClientProjectDueDate) values('2015-06-14'); Query OK, 1 row affected (0.23 sec)Display all records from ... Read More

Listing All Rows by Group with MySQL GROUP BY

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

1K+ Views

To list all rows by group, you can use GROUP_CONCAT(). Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Name varchar(20),    Value varchar(100)    ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Value) values('John', 'John'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Name, Value) values('Carol', 'Carol'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(Name, Value) values('John', 'Works'); Query OK, 1 row affected (0.13 sec) mysql> insert ... Read More

HTML Color Styles

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

365 Views

Colors are very important to give a good look and feel to your website.Hex Code (Hexadecimal colors representation)A hexadecimal is a 6 digit representation of a color. The first two digits (RR) represent a red value, the next two are a green value(GG), and the last are the blue value(BB).A hexadecimal value can be taken from any graphics software like Adobe Photoshop. Each hexadecimal code will be preceded by a pound or hash sign #. Following is a list of few colors using hexadecimal notation. Following are some examples of hexadecimal colors −Let us see an example to implement the ... Read More

Advertisements