Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to get the count of both present and absent students for a year in MySQL?
For this, you can use IF() along with aggregate function SUM(). Let us first create a table −mysql> create table DemoTable1617 -> ( -> Attendance varchar(20), -> CurrentYear int -> ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1617 values('Present', 2019); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1617 values('Absent', 2019); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1617 values('Absent', 2017); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1617 values('Present', 2019); Query ...
Read MoreSelect total from a MySQL table based on month
For this, you can use GROUP BY MONTH(). Let us first create a table −mysql> create table DemoTable1628 -> ( -> PurchaseDate date, -> Amount int -> ); Query OK, 0 rows affected (1.55 sec)Insert some records in the table using insert command.mysql> insert into DemoTable1628 values('2019-01-10', 1500); Query OK, 1 row affected (0.68 sec) mysql> insert into DemoTable1628 values('2019-10-10', 2000); Query OK, 1 row affected (0.61 sec) mysql> insert into DemoTable1628 values('2019-10-24', 100); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1628 values('2019-11-10', 500); Query OK, 1 row affected ...
Read MoreWhat happens to the current MySQL transaction if the session is killed by DBA?
Suppose if a session is killed in the middle of a transaction then that current MySQL transaction will be rolled back by MySQL and ended. It means that all the database changes made in the current transaction will be removed. It is called n implicit rollback when the session is killed.ExampleSuppose we have the following values in the table ‘marks’mysql> Select * from marks; +------+---------+-----------+-------+ | Id | Name | Subject | Marks | +------+---------+-----------+-------+ | 1 | Aarav | Maths | 50 | | 1 | Harshit | Maths ...
Read MoreManaging cross database container access in SAP HANA
The cross database container access is managed in Global.ini file in Configuration under System Administration.To access global.ini file you need to navigate to Administration tab in HANA Studio → Configuration and there you can find Global.ini file.
Read MoreViewing table definition in SAP HANA
To check table definition, you need to right click on table name → Open Definition and this will open table structure under HANA database.
Read MoreSQL statement to create a Restricted user in SAP HANA
It is very simple. You can create a Restricted user with below query −CREATE [RESTRICTED] USER [] [ ] [ ] [ ] [ ] [ ] []In above SQL query, you have to pass following parameters −Specifies a database user in another tenant database as the remote identity of the database user being created.Specifies the user password of the user being created.Defines an external identification mechanism.Defines an external identity that is used to authenticate the user.
Read MoreChecking create time for all users in SAP HANA
This can be found using following SQL command −SELECT * from USERS;
Read MoreUnderstanding a database view in SAP HANA database
Consider the following example −Example Id Empl. NameEmpl.userEmpl.passwordJoining Date1 Employee 1 Emp1Emp1Pwd 9/11/20162 Employee 2Emp2Emp2Pwd16/08/20153Employee 3 Emp3Emp3Pwd 15/09/20164Employee 4Emp4 Emp4Pwd3/07/20145Employee 5 Emp5 Emp5Pwd 10/09/20126 Employee 6Emp6 Emp6Pwd 1/10/2013 Consider a scenario when a developer needs to analyze some data of Employee Table with the above fields. Using database view, an administrator can create a virtual table which only contains information about Employee Id, Employee name, and date of joining and give permission to developer to use that view.
Read MoreWhat are some frequently used mysqlimport options while uploading the data into MySQL table through command line?
mysqlimport can be run with a number of options. Followings are some options for mysqlimport and their effect on import.OptionAction-r or –replaceCause imported rows to overwrite existing rows if they have the same unique key value.-i or –ignoreIgnore rows that have the same unique key value as existing rows.-f or –forceForce mysqlimport to continue inserting data even if errors are encountered.-l or --lock-tablesLock each table before importing (a good option on a busy server).-d or –deleteEmpty the table before inserting.--fields-terminated- by='char'Specify the separator used between values of the same row, default \t (tab).--fields-enclosed- by='char'Specify the delimiter that encloses each field; ...
Read MoreHow to apply EXTRACT() function with WHERE Clause on the dates stored in MySQL table?
With the help of following MySQL query, we can apply EXTRACT() function with WHERE clause on the dates stored in a table.mysql> Select StudentName,EXTRACT(Year from dateofreg)AS YEAR from testing WHERE StudentName = 'Gaurav'; +-------------+------+ | StudentName | YEAR | +-------------+------+ | Gaurav | 2017 | +-------------+------+ 1 row in set (0.00 sec)
Read More