Articles on Trending Technologies

Technical articles with clear explanations and examples

Can we create a database with a numeric name with MySQL?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 468 Views

You cannot create database with numeric name as shown below −mysql> create database 1233;This will produce the following output −ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1233' at line 1To create a database with numeric name, you need to use backticks around the database name −create database yourDatabaseName;Let us implement the above syntax −mysql> create database `1233`; Query OK, 1 row affected (0.20 sec)Now you can switch to the same database −mysql> use `1233`; Database changed

Read More

How can I see how long statements take to execute on the MySQL command line?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 208 Views

For every single statement on MySQL command line, it shows the exact time to execute the specific statement.Let us first create a table −mysql> create table DemoTable1589    -> (    -> EmployeeId int,    -> EmployeeName varchar(20)    -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1589 values(101, 'Sam'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1589 values(102, 'Bob'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1589 values(103, 'David'); Query OK, 1 row affected (0.16 sec)Display all records from the table ...

Read More

Select maximum of sum of two columns in MySQL

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 678 Views

To select maximum of sum of two columns, use aggregate function MAX() along with subquery. Let us first create a table −mysql> create table DemoTable1587    -> (    -> Value1 int,    -> Value2 int    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1587 values(30, 50); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1587 values(80, 90); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1587 values(40, 67); Query OK, 1 row affected (0.13 sec)Display all records from the table using select ...

Read More

Using ControlAggregation in SAPUI5

Govinda Sai
Govinda Sai
Updated on 16-Dec-2019 848 Views

“ControlAggregation” refers to the target aggregation to which the mapped view is added.As Specified in the use case below:"routing": {    "config": {       "routerClass": "sap.m.routing.Router",       "viewType": "XML",       "viewPath": "sap.ui.demo.nav.view",       "controlId": "app",       "controlAggregation": "dummy",       "transition": "slide",       "bypassed": {          "target": "NA"       }ExampleThe views are defined as follows:     So here “controlAggregation” is named as 'dummy' but the app is named as SampleApp.so the target is 'sap.m.SampleApp' and aggregation is named as 'dummy'. Let ...

Read More

Display information about field names in MySQL including TYPE, KEY, etc.

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 144 Views

To display information about field names, the syntax is as follows −show columns from yourTableName;Let us first create a table −mysql> create table DemoTable1586    -> (    -> EmployeeId int,    -> EmployeeFirstName varchar(20),    -> EmployeeLastName varchar(20),    -> EmployeeAge int,    -> EmployeeCountryName varchar(20),    -> EmployeeSalary int    -> ); Query OK, 0 rows affected (0.78 sec)Following is the query to display field names −mysql> show columns from DemoTable1586;This will produce the following output −+---------------------+-------------+------+-----+---------+-------+ | Field               | Type        | Null | Key | Default | ...

Read More

What will happen if we have set UNIQUE and multiple insertion with duplicate values

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 161 Views

An error will arise and nothing will get inserted in the table Let us see an example and create a table −mysql> create table DemoTable1585    -> (    -> StudentId int,    -> StudentMarks int,    -> UNIQUE(StudentId)    -> ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1585 values(1,87),(2,98),(3,91),(3,48); ERROR 1062 (23000): Duplicate entry '3' for key 'StudentId'Display all records from the table using select statement −mysql> select * from DemoTable1585;This will produce the following output. Nothing gets inserted:Empty set (0.00 sec)

Read More

Deleting partial data from a field in MySQL?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 314 Views

To delete partial data, use UPDATE command along with REPLACE(). Let us first create a table −mysql> create table DemoTable1583    -> (    -> GameDetails text    -> ); Query OK, 0 rows affected (1.38 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1583 values('=Candy, 2000'); Query OK, 1 row affected (0.53 sec) mysql> insert into DemoTable1583 values('=Lucky29, 10000'); Query OK, 1 row affected (0.25 sec)Display all records from the table using select statement −mysql> select * from DemoTable1583;This will produce the following output −+------------------------------------------------------------+ | GameDetails                 ...

Read More

Query MySQL table and fetch rows posted before the last 3 days?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 184 Views

Let’s say the current date is −'2019-10-20We will first see an example and create a table −mysql> create table DemoTable1582    -> (    -> PostedDate datetime    -> ); Query OK, 0 rows affected (13.36 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1582 values('2019-01-21 12:34:40'); Query OK, 1 row affected (1.06 sec) mysql> insert into DemoTable1582 values('2019-10-15 11:00:00'); Query OK, 1 row affected (0.87 sec) mysql> insert into DemoTable1582 values('2019-10-25 1:10:00'); Query OK, 1 row affected (1.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable1582;This will produce the ...

Read More

How to get all elements of a List that match the conditions specified by the predicate in C#?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 676 Views

To get all elements of a List that match the conditions specified by the predicate, the code is as follows −Exampleusing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i) {       return ((i % 3) == 0);    }    public static void Main(String[] args) {       List list = new List();       list.Add(9);       list.Add(15);       list.Add(20);       list.Add(40);       list.Add(50);       list.Add(60);       Console.WriteLine("List elements...");       foreach (int i in list) {   ...

Read More

How to ensure that MySQL rows are unique?

AmitDiwan
AmitDiwan
Updated on 16-Dec-2019 483 Views

To ensure that MySQL rows are unique, you need to use UNIQUE constraint. Let us first create a table −mysql> create table DemoTable1580    -> (    -> id int,    -> Name varchar(20),    -> Age int    -> ); Query OK, 0 rows affected (0.73 sec)Here is the query to create unique constraints to ensure MySQL rows are unique −mysql> alter table DemoTable1580 add unique index(id, Name, Age); Query OK, 0 rows affected (0.45 sec) Records: 0  Duplicates: 0  Warnings: 0Insert some records in the table using insert command −mysql> insert into DemoTable1580 values(101, 'Chris', 21); Query OK, ...

Read More
Showing 54051–54060 of 61,248 articles
Advertisements