Dark Mode On/Off

All questions must be answered. Here are the Answers given by this user in the Forum.

We will check and let you know soon
3 years ago
***
#include

int secondSmallest(int arr[],int n)
{
int min = arr[0];
int second_min = arr[0] ;
int i;
for(i = 0; i < n; i++) //Array Traversal
{
if(arr[i] < min)
{
second_min = min;
min = arr[i];
}
else if(arr[i] < second_min && arr[i] != min) //Check for second smallest
{
second_min = arr[i];
}
}
return second_min; //Return second smallest
}
int secondLargest(int arr[],int n)
{
int i, first, second;
if (n < 2) {
printf(" Invalid Input ");
return;
}
first = second =arr[0]; //Array Traversal
for (i = 0; i < n; i++)
{
if (arr[i] > first)
{
second = first;
first = arr[i];
}

else if (arr[i] > second && arr[i] != first) //Check for second largest
{
second = arr[i];
}
}
return second; //Return second largest
}
int main() {
int n;
printf("Enter the number of elements:");
scanf("%d",&n);
printf("Enter the array elements :");
int a[n]; //Array Declaration
for(int i=0;i {
scanf("%d",&a[i]);
}
if(n<2)
{
printf("Invalid Input");
}
else
{
int sS=secondSmallest(a,n);
printf("The second smallest element is %d",sS);
printf("\n");
int sL=secondLargest(a,n);
printf("The second largest element is %d",sL);
}
return 0;
}
***
3 years ago
hello, can you enter the code here that you are trying to enter ?
3 years ago
Hello, Kindly tell us which topic and which test number ?
3 years ago
Ques:  Score of exam
hello, can you paste the code that you are trying to enter ?
3 years ago
Well you can use below command,

mysqldump --databases --user=root --password your_db_name > export_into_db.sql

and the generated file will be available in the same directory where you had ran this command.

You could find more on the official reference for mysqldump: Import Export MySQL DB

Note: use --databases instead of --database since the last one is no more supported.

Enjoy :)
3 years ago
I'm guessing that Clients.Case_Number and/or Staff.Emp_ID are not exactly the same data type as Clients_has_Staff.Clients_Case_Number and Clients_has_Staff.Staff_Emp_ID.

Perhaps the columns in the parent tables are INT UNSIGNED?

They need to be exactly the same data type in both tables.
3 years ago
***
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
***
For Debian, and other distributions using Debian style packaging the ruby development headers are installed by:
***
sudo apt-get install ruby-dev
***
For Ubuntu the ruby development headers are installed by:
***
sudo apt-get install ruby-all-dev
***
If you are using a earlier version of ruby (such as 2.2), then you will need to run:
***
sudo apt-get install ruby2.2-dev
***
3 years ago
Change in the my.ini or ~/.my.cnf file by including the single line under [mysqld] or [client] section in your file:

max_allowed_packet=500M
then restart the MySQL service and you are done.
3 years ago
In MySql Workbench (6.0) its possible generate one diagram based on tables created. For that you should access to the tools bar, press Model and forward Create Diagram from Catalog Objects and done!
3 years ago
You can use DESCRIBE:
***
DESCRIBE my_table;
***
Or in newer versions you can use INFORMATION_SCHEMA:
***
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
***
Or you can use SHOW COLUMNS:
***
SHOW COLUMNS FROM my_table;
***
Or to get column names with comma in a line:
***
SELECT group_concat(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
***
3 years ago
To set the default to UTF-8, you want to add the following to my.cnf/my.ini
***
[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_unicode_520_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
***
If you want to change the character set for an existing DB, let me know... your question didn't specify it directly so I am not sure if that's what you want to do.

Edit: I replaced utf8 with utf8mb4 in the original answer due to utf8 only being a subset of UTF-8. MySQL and MariaDB both call UTF-8 utf8mb4.
3 years ago