Let us first create a table −mysql> create table DemoTable ( Id int, Name varchar(50) ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1001, 'Robert'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(1002, 'Sam'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(1003, 'Tom'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+------+--------+ | Id | Name | ... Read More
For this, you can use a CASE statement. Let us first create a table −mysql> create table DemoTable ( ProductName varchar(100), ProductRating ENUM('1', '2', '3') ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Product-1', 3); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Product-2', 1); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('Product-3', 2); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Product-1', 2); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Product-3', ... Read More
To insert multiple parameter values into a single column, use the CONCAT_WS() or CONCAT(). Let us first create a table −mysql> create table DemoTable ( Name varchar(100), Age int, CountryName varchar(100), PersonInformation text ); Query OK, 0 rows affected (0.67 sec)Following is the query to insert multiple parameter values into a single column. We will do this using the same INSERT command, which is used to insert records in a MySQL table −mysql> insert into DemoTable values('John', 21, 'US', concat_ws('-', Name, Age, CountryName)); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Chris', 22, ... Read More
To make IntelliJ to recognize common Python modules, just create and add Python SDKFile -> Project Structure -> Project -> Project SDK -> newand select the installation path of your Python interpreter (for example, C:\Python26 in windows and /usr/bin/python2.7 in Linux) as the home path. This allows IntelliJ to look in these directories to give you suggestions and documentation hints.If your Python SDK is already properly configured and you are still facing the problem that builtins are not recognized, try this:File -> Invalidate Caches/Restart
For user-defined variables, we use @ in MySQL. Following is the syntax. Here, @anyVariableName is our user-defined variable −select yourColumnName into @anyVariableName from yourTableName where yourCondition;Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(100) ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('Chris'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Name) values('Robert'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(Name) values('David'); Query OK, 1 row affected (0.10 sec)Display all ... Read More
To get the length of all columns i.e. the count of all the characters for column values, use char_length(). Let us first create a table. Here, we have two columns, therefore we will calculate for each row consisting of both the values FirstName and LastName −mysql> create table DemoTable ( FirstName varchar(100), LastName varchar(100) ); Query OK, 0 rows affected (1.07 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 'Brown'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('David', 'Miller'); Query OK, 1 row affected (0.11 sec) mysql> insert ... Read More
Following is the syntax −delete from yourTableName where yourColumnName < (yourAnotherDateValue - INTERVAL 30 DAY);Let us first create a table −mysql> create table DemoTable ( DueDate date ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-08-25'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('2019-07-01'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('2019-06-20'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('2019-09-02'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement ... Read More
For this, use CONCAT() method in MySQL. Let us first create a table −mysql> create table DemoTable ( FirstName varchar(50), LastName varchar(50) ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 'Brown'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('David', 'Miller'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('John', 'Doe'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('Adam', 'Smith'); Query OK, 1 row affected (0.25 sec)Display all records from the table using select statement ... Read More
To alter column type of multiple columns in a single MySQL query, the syntax is as follows −alter table yourTableName modify column yourColumnName 1 yourDataType1, modify column yourColumnName 2 yourDataType2, . . N;Let us first create a table −mysql> create table DemoTable ( Id varchar(100), FirstName text, LastName text ); Query OK, 0 rows affected (0.52 sec)Let us check the description of table −mysql> desc DemoTable;This will produce the following output −+-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | ... Read More
You need to have Python, pip, virtualenv, awswebcli and a SSH client installed to set up your Python Development Environment on AWS. You can follow instructions at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html to install these.Once you have all those installed, you need to set up a virtual environment so that your global packages do not get polluted. Use the following command to set up a virtual environment:$ virtualenv -p python2.7 /tmp/hello-world Running virtualenv with interpreter /usr/bin/python2.7 New python executable in /tmp/hello-world/bin/python2.7 Also creating executable in /tmp/hello-world/bin/python Installing setuptools, pip...done.Once your virtual environment is ready, start it by running the activate script located in the ... Read More