code-rag-bench/online-tutorials huggingface dataset:
Find all Tables that contain a specific Column name in SQL Server - GeeksforGeeks

21 Jan, 2021
As a SQL DBA, we might need to write a SQL Query to Find all Tables that Contain Specific Column Name with example.Below screenshot will show you the tables inside the database ‘SQL_DBA‘
Find all tables that contain a specific column name in SQL Database :In the below example, we are using INFORMATION_SCHEMA.COLUMNS to get the table names where the column name is like ‘%Err%’.Query –SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, 
ORDINAL_POSITION as org_pos, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH as CML
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME like '%Err%'
ORDER BY TABLE_NAMEOutput –TABLE_CATALOGTABLE_SCHEMATABLE_NAMECOLUMN_NAMEorg_posDATA_TYPECMLSQL_DBAdbotbl_Errors_StatsErrodate6datetimeNULLSQL_DBAdbotbl_Errors_StatsErrorMsg5varchar-1
Query –
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, 
ORDINAL_POSITION as org_pos, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH as CML
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME like '%Err%'
ORDER BY TABLE_NAME
Output –
Find all tables that contain a specific column name :In this example, we are using the sys.column to get the column information, and sys.tables to get the database table names.
Query –
SELECT col.name AS [Column Name], tab.name AS [Table Name]
FROM sys.columns col
INNER JOIN sys.tables tab
ON col.object_id = tab.object_id
WHERE col.name LIKE '%Name%'
ORDER BY [Table Name], [Column Name]
Output –
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Update Multiple Columns in Single Update Statement in SQL?
How to Alter Multiple Columns at Once in SQL Server?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
SQL Query to Convert VARCHAR to INT
SQL | Date functions
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Insert Multiple Rows
How to use the ValidateScript attribute in PowerShell function?

The ValidateScript attribute is to validate the script before entering inside the function. For example, let say you want to validate the path of the file, validate the remote computer connectivity, etc. We will take here remote server connectivity example.
Without the ValidateScript attribute, we would have written the script as shown below.
Function Check-RemoteServer {
   param (
      [string]$Server
   )
   if(Test-Connection -ComputerName $Server -Count 2 -Quiet -ErrorAction Ignore) {
      Write-Output "$server is reachable"
   } else {
      Write-Output "$Server is unreachable"
   }
}
PS C:\> Check-RemoteServer -Server asde.asde
asde.asde is unreachable
PS C:\> Check-RemoteServer -Server Google.com
Google.com is reachable
With the ValidateScript attribute, script will be reduced to few lines of code.
Function Check-RemoteServer {
   param (
      [ValidateScript({Test-Connection -ComputerName $_ -Count 2 -
      Quiet}, ErrorMessage = "Remote Server unreachable")]
      [string]$Server
   )
   Write-Output "$Server is reachable"
}
PS C:\> Check-RemoteServer -Server Google.com
Google.com is reachable
PS C:\> Check-RemoteServer -Server asde.asde
Check-RemoteServer: Cannot validate argument on parameter 'Server'. Remote Server unreachable
PyQt5 - QLabel Widget

A QLabel object acts as a placeholder to display non-editable text or image, or a movie of animated GIF. It can also be used as a mnemonic key for other widgets. Plain text, hyperlink or rich text can be displayed on the label.
The following table lists the important methods defined in QLabel class −
setAlignment()
Aligns the text as per alignment constants
Qt.AlignLeft
Qt.AlignRight
Qt.AlignCenter
Qt.AlignJustify
setIndent()
Sets the labels text indent
setPixmap()
Displays an image
Text()
Displays the caption of the label
setText()
Programmatically sets the caption
selectedText()
Displays the selected text from the label (The textInteractionFlag must be set to TextSelectableByMouse)
setBuddy()
Associates the label with any input widget
setWordWrap()
Enables or disables wrapping text in the label
In this example, QLabel objects l2 and l4 have the caption containing hyperlink. setOpenExternalLinks for l2 is set to true. Hence, if this label is clicked, the associated URL will open in the browser. linkHovered signal of l4 is connected to hovered() function. So, whenever the mouse hovers over it, the function will be executed.
QPixmap object prepares offscreen image from python.jpg file. It is displayed as label l3 by using setPixmap() method.
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
def window():
   app = QApplication(sys.argv)
   win = QWidget() 
	
   l1 = QLabel()
   l2 = QLabel()
   l3 = QLabel()
   l4 = QLabel()
	
   l1.setText("Hello World")
   l4.setText("TutorialsPoint")
   l2.setText("welcome to Python GUI Programming")
	
   l1.setAlignment(Qt.AlignCenter)
   l3.setAlignment(Qt.AlignCenter)
   l4.setAlignment(Qt.AlignRight)
   l3.setPixmap(QPixmap("python.jpg"))
	
   vbox = QVBoxLayout()
   vbox.addWidget(l1)
   vbox.addStretch()
   vbox.addWidget(l2)
   vbox.addStretch()
   vbox.addWidget(l3)
   vbox.addStretch()
   vbox.addWidget(l4)
	
   l1.setOpenExternalLinks(True)
   l4.linkActivated.connect(clicked)
   l2.linkHovered.connect(hovered)
   l1.setTextInteractionFlags(Qt.TextSelectableByMouse)
   win.setLayout(vbox)
	
   win.setWindowTitle("QLabel Demo")
   win.show()
   sys.exit(app.exec_())
	
def hovered():
   print "hovering"
def clicked():
   print "clicked"
	
if __name__ == '__main__':
   window()
The above code produces the following output −

    146 Lectures 
     22.5 hours 

 ALAA EID
 Print
 Add Notes
 Bookmark this page
Batch Script - VER

This batch command shows the version of MS-DOS you are using.
ver

@echo off 
ver
The output of the above command is as follows. The version number will depend upon the operating system you are working on.
Microsoft Windows [Version 6.3.9600]

 Print
 Add Notes
 Bookmark this page
Regular Expression \b Metacharacter in Java

The subexpression/metacharacter “\b” matches the word boundaries when outside the brackets. Matches the backspace (0x08) when inside the brackets.
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexExample {
   public static void main( String args[] ) {
      String regex = "\\bbecause\\b";
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter a string: ");
      String input = sc.nextLine();
      Pattern p = Pattern.compile(regex);
      Matcher m = p.matcher(input);
      int count = 0;
      while(m.find()) {
         count ++;
      }
      System.out.println("Number of matches: "+count);
   }
}
Enter a string:
A sentence doesn't end with because because, because is a conjunction
Number of matches: 3
The following Java example reads a string value from the user and prints the number of word boundaries.
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
   public static void main( String args[] ) {
      System.out.println("Enter input string: ");
      Scanner sc = new Scanner(System.in);
      String input = sc.nextLine();
      String regex = "\\b";
      //Compiling the regular expression
      Pattern pattern = Pattern.compile(regex);
      //Retrieving the matcher object
      Matcher matcher = pattern.matcher(input);
      int count =0;
      while(matcher.find()) {
         count ++;
      }
      System.out.println(count);
   }
}
Enter input string:
Hello how are you welcome to Tutorialspoint
14
Python - Scatter Plots

Scatterplots show many points plotted in the Cartesian plane. Each point represents the values of two variables. One variable is chosen in the horizontal axis and another in the vertical axis.
Scatter plot can be created using the DataFrame.plot.scatter() methods.
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(50, 4), columns=['a', 'b', 'c', 'd'])
df.plot.scatter(x='a', y='b')
 
Its output is as follows −

    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
How to get rows and columns of 2D array in Java? 

Following example helps to determine the rows and columns of a two-dimensional array with the use of arrayname.length.
Following example helps to determine the upper bound of a two dimensional array with the use of arrayname.length. 
public class Main {
   public static void main(String args[]) {
      String[][] data = new String[2][5];
      System.out.println("Dimension 1: " + data.length);
      System.out.println("Dimension 2: " + data[0].length);
   }
}
The above code sample will produce the following result. 
Dimension 1: 2
Dimension 2: 5
How to create a fixed side navigation menu with CSS?

Following is the code to create a fixed side navigation menu using CSS −
 Live Demo
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
   margin: 0px;
   margin-top: 10px;
   padding: 0px;
}
nav {
   height: 100vh;
   width: 200px;
   position: fixed;
   z-index: 1;
   top: 0;
   left: 0;
   background-color: rgb(39, 39, 39);
   overflow: auto;
   height: 100%;
}
.links {
   display: block;
   text-align: center;
   padding: 14px;
   color: rgb(178, 137, 253);
   text-decoration: none;
   font-size: 17px;
}
.links:hover {
   background-color: rgb(100, 100, 100);
}
input[type="text"] {
   float: right;
   padding: 6px;
   margin-top: 8px;
   margin-right: 8px;
   font-size: 17px;
}
.selected {
   background-color: rgb(0, 18, 43);
}
</style>
</head>
<body>
<nav>
<a class="links selected" href="#"> Home</a>
<a class="links" href="#"> Login </a>
<a class="links" href="#">Register</a>
<a class="links" href="#">Contact Us</a>
<a class="links" href="#">More Info</a>
</nav>
</body>
</html>
This will produce the following output −
java.time.OffsetDateTime.of() Method Example

The java.time.OffsetDateTime.of(LocalDate date, LocalTime time, ZoneOffset offset) method obtains an instance of OffsetDateTime from a date, time and offset.
Following is the declaration for java.time.OffsetDateTime.of(LocalDate date, LocalTime time, ZoneOffset offset) method.
public static OffsetDateTime of(LocalDate date, LocalTime time, ZoneOffset offset)

date − the local date, not null
date − the local date, not null
time − the local time, not null
time − the local time, not null
offset − the zone offset, not null
offset − the zone offset, not null
the offset date-time, not null.
The following example shows the usage of java.time.OffsetDateTime.of(LocalDate date, LocalTime time, ZoneOffset offset) method.
package com.tutorialspoint;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;

public class OffsetDateTimeDemo {
   public static void main(String[] args) {

      LocalDate localDate = LocalDate.parse("2017-02-03");
      LocalTime localTime = LocalTime.parse("12:30:30");
      OffsetDateTime date = OffsetDateTime.of(localDate, localTime,ZoneOffset.UTC);
      System.out.println(date);  
   }
}
Let us compile and run the above program, this will produce the following result −
2017-02-03T12:30:30Z

 Print
 Add Notes
 Bookmark this page
Java Examples - Play sound using Applet?

How to play sound using Applet?
Following example demonstrates how to play a sound using an applet image using getAudioClip(), play() & stop() methods of AudioClip() class.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class PlaySoundApplet extends Applet implements ActionListener {
   Button play,stop;
   AudioClip audioClip;
   
   public void init() {
      play = new Button(" Play in Loop ");
      add(play);
      play.addActionListener(this);
      stop = new Button(" Stop ");
      add(stop);
      stop.addActionListener(this);
      audioClip = getAudioClip(getCodeBase(), "Sound.wav");
   }
   public void actionPerformed(ActionEvent ae) {
      Button source = (Button)ae.getSource();
      if (source.getLabel() == " Play in Loop ") {
         audioClip.play();
      } else if(source.getLabel() == "  Stop  "){
         audioClip.stop();
      }
   }
}
The above code sample will produce the following result in a java enabled web browser.
View in Browser. 

 Print
 Add Notes
 Bookmark this page
Scala Collections - FoldLeft Method

foldLeft() method is a member of  TraversableOnce trait, it is used to collapse elements of collections. It navigates elements from Left to Right order. It is primarily used in recursive functions and prevents stack overflow exceptions.
The following is the syntax of fold method.
def foldLeft[B](z: B)(op: (B, A) ? B): B

Here, foldLeft method takes associative binary operator function as a parameter. This method returns the result as value.
Below is an example program of showing how to use foldLeft method −
object Demo {
   def main(args: Array[String]) = {
      val list = List(1, 2, 3 ,4)
      //apply operation to get sum of all elements of the list
      val result = list.foldLeft(0)(_ + _)
      //print result
      println(result)      
   }
}
Here we've passed 0 as initial value to fold function and then all values are added. Save the above program in Demo.scala. The following commands are used to compile and execute this program.
\>scalac Demo.scala
\>scala Demo

10


    82 Lectures 
     7 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    76 Lectures 
     5.5 hours 

 Bigdata Engineer

    69 Lectures 
     7.5 hours 

 Bigdata Engineer

    46 Lectures 
     4.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Difference between constants and final variables in Java?

A constant variable is the one whose value is fixed and only one copy of it exists in the program. Once you declare a constant variable and assign value to it, you cannot change its value again throughout the program.
Unlike in C language constants are not supported in Java(directly). But, you can still create a constant by declaring a variable static and final.
Once you declare a variable static they will be loaded in to the memory at the compile time i.e. only one copy of them is available.
Once you declare a variable static they will be loaded in to the memory at the compile time i.e. only one copy of them is available.
once you declare a variable final you cannot modify its value again.
once you declare a variable final you cannot modify its value again.
 Live Demo
class Data {
   static final int integerConstant = 20;
}
public class ConstantsExample {
   public static void main(String args[]) {
      System.out.println("value of integerConstant: "+Data.integerConstant);
   }
}
value of integerConstant: 20
Once you declare a variable final you cannot change its value. If you try to do so a compile time error will be generated.
 Live Demo
public class FinalExample {
   public static void main(String args[]) {
      final int num = 200;
      num = 2544;
   }
}
FinalExample.java:4: error: cannot assign a value to final variable num
   num = 2544;
   ^
1 error
The main difference between final variable and a constant (static and final) is that if you create a final variable without static keyword, though its value is un-modifiable, a separate copy of the variable is created each time you create a new object. Where a constant is un-modifiable and have only one copy through out the program. For example, consider the following Java program,
 Live Demo
class Data {
   final int integerConstant = 20;
}
public class ConstantExample {
   public static void main(String args[]) {
      Data obj1 = new Data();
      System.out.println("value of integerConstant: "+obj1.integerConstant);
      Data obj2 = new Data();
      System.out.println("value of integerConstant: "+obj2.integerConstant);
   }
}
value of integerConstant: 20
value of integerConstant: 20
Here we have created a final variable and trying to print its value using two objects, thought value of the variable is same at both instances, since we have used a different object for each they are the copies of the actual variable.
According to the definition of the constant you need to have a single copy of the variable throughout the program (class).
Therefore, to create constant as pert definition, you need to declare it both static and final.
accept command in Linux with Examples - GeeksforGeeks

30 Jun, 2020
In Linux, accept command is used to request the printer to start accepting print requests in the print queue for a named destination that could be a printer or a class of printer. It also enables the user to submit the print requests to the printer, even when the printer is not connected to the system. These requests can then be processed later using the accept command.
Syntax:
accept [ -E ] [ -U username ] [ -h hostname[:port] ] destination(s)
-E – causes the printer to accept requests by enabling the printer automatically.
-U – sets the username which is to be sent while connecting to the server.
-h – used to connect to a printer at a remote server
Executing accept command for the destination printer(HP-LaserJet-Professional-P1108), which is connected directly to the system.
Step 1. Get the current status of printer by using lpstat command.
lpstat -a -p HP-LaserJet-Professional-P1108
Step 2. Sending the request through accept command.
accept -E HP-LaserJet-Professional-P1108
Step 3. Get the status again in order to check the request by accept command.
lpstat -a -p HP-LaserJet-Professional-P1108
Now the print requests before the execution of the accept command, have been executed and now are not present in print queue.
To connect to a printer at a remote server.Enter the following command to connect to a printer available at a server 120.10.100.100 and at port 631.
accept -h 120.10.100.100:631 HP-LaserJet-Professional-P1108
Operation was failed here because no printer is currently available at the port mentioned. But if the printer would be connected then it will accept the request.
linux-command
Linux-system-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
nohup Command in Linux with Examples
scp command in Linux with Examples
Thread functions in C/C++
mv command in Linux with examples
chown command in Linux with Examples
SED command in Linux | Set 2
Docker - COPY Instruction
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
nslookup command in Linux with Examples
MomentJS - Start of Time

Start of Time method will set the display to the start of the unit given.
moment().startOf(String);

var day = moment().startOf('year');
This will display the first day of the year and will set the time, that is hours, minutes, seconds to 00:00:00 as shown below −
var day = moment().startOf('month');
This will display the first day of the month and will set the time, that is hours, minutes and seconds to 00:00:00 as shown below −
var day = moment().startOf('quarter');
This will give the details of the start of the current quarter. Time will be set to 12 am.
If we check the quarter for the month of February using the command shown here, the output will be from 1st of Jan as shown below −
var day = moment().startOf('quarter');
var day = moment().startOf('week');
 Print
 Add Notes
 Bookmark this page
JavaScript - Math abs Method

This method returns the absolute value of a number.
Its syntax is as follows −
Math.abs( x ) ;

x  − A number.
Returns the absolute value of a number.
Try the following example program.
<html>  
   <head>
      <title>JavaScript Math abs() Method</title>
   </head>
   
   <body>   
      <script type = "text/javascript">
         var value = Math.abs(-1);
         document.write("First Test Value : " + value ); 
         
         var value = Math.abs(null);
         document.write("<br />Second Test Value : " + value ); 
         
         var value = Math.abs(20);
         document.write("<br />Third Test Value : " + value ); 
         
         var value = Math.abs("string");
         document.write("<br />Fourth Test Value : " + value ); 
      </script>   
   </body>
</html>
First Test Value : 1
Second Test Value : 0
Third Test Value : 20
Fourth Test Value : NaN 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Does SQL Server have an equivalent to MySQL's ENUM data type?

This works in MySQL version 8.0.12. The syntax is as follows.
create table yourTableName
(
yourColumnName enum(‘Value1’,Value2’,Value3’,......N)
default Value1’ or Value2 or Value3,..N
);
Set the enum type in MySQL with the following query.
mysql> create table EnumInMySQL
-> (
-> WebCRUD enum('CREATE','READ','UPDATE','DELETE')
-> default 'CREATE'
-> );
Query OK, 0 rows affected (0.60 sec)
The syntax of enum in SQL Server.
create table yourTableName
(
yourColumnName varchar(100)
CHECK(yourColumnName IN (‘Value1’,Value2’,Value3’,......N))
DEFAULT ‘Value1’ or Value2’ or Value3’,......N
);
Now the query is as follows for enum in SQL Server.
How can we use lambda expressions with functional interfaces in Java?

The lambda expressions are anonymous functions and don't have any return type, access modifier and not belonging to any class. It can be used to simplify the implementation of the abstract method in a functional interface. Whenever there is a functional interface, we can use lambda expressions instead of anonymous inner classes.
([comma seperated argument-list]) -> {body}
@FunctionalInterface
interface BonusCalculator {
   public double calcBonus(int amount);
}
class EmpDetails {
   public void getBonus(BonusCalculator calculator, int amount) {
      double bonus = calculator.calcBonus(amount);
      System.out.println("Bonus: " + bonus);
   }
}
public class LambdaExpressionTest {
   public static void main(String[] args) {
      EmpDetails details = new EmpDetails();
      //Using Anonymous inner class
      EmpDetails details = new EmpDetails();
      details.getBonus(new BonusCalculator () {
         public double calcBonus(int amount) {
            System.out.println("Bonus Calculation of an Employee using Ananymous inner class");
            return amount*2;
         }
      },2000);
      // using Lambda Expression
      details.getBonus((amount) -> {
         System.out.println("Bonus Calculation of an Employee using Lambda Expression");
         return amount*2;
      },2000);
   }
}
Bonus Calculation of an Employee using Anonymous inner class
Bonus: 4000.0
Bonus Calculation of an Employee using Lambda Expression
Bonus: 4000.0
Express.js – app.route() Method

The app.route() method returns the instance of a single route. This single route can be used to handle the HTTP verbs with the optional middleware. This method is mainly used to avoid duplicate names.
app.route( )
Create a file with the name "appRoute.js" and copy the following code snippet. After creating the file, use the command "node appRoute.js" to run this code.
// app.route() Demo Example

// Importing the express module
var express = require('express');

// Initializing the express and port number
var app = express();
var PORT = 3000;

// Creating a get, post & other requests
app.route('/user')
.get((req, res, next) => {
   res.send('GET is called');
   console.log('GET is called');
})

.post((req, res, next) => {
   res.send('POST is called');
   console.log('POST is called')
})
.all((req, res, next) => {
   res.send('All others are called');
   console.log('All others are called')
})

app.listen(PORT, function(err){
   if (err) console.log(err);
   console.log("Server listening on PORT", PORT);
});
Hit the below endpoints/API to call the above function −
GET
http://localhost:3000/user
GET
http://localhost:3000/user
POST
http://localhost:3000/user
POST
http://localhost:3000/user
PUT
http://localhost:3000/user
PUT
http://localhost:3000/user
C:\home\node>> node appRoute.js
''
'/api'
'/api/v1'
Let’s take a look at one more example.
// app.route() Demo Example

// Importing the express module
var express = require('express');

// Initializing the express and port number
var app = express();
var PORT = 3000;

// Creating a get, post & other requests
app.route('/api/*')
.get((req, res, next) => {
   res.send('GET is called');
   console.log('GET is called');
})

.post((req, res, next) => {
   res.send('POST is called');
   console.log('POST is called')
})

.all((req, res, next) => {
   res.send('All others are called');
   console.log('All others are called')
})

app.listen(PORT, function(err){
   if (err) console.log(err);
   console.log("Server listening on PORT", PORT);
});
For the above function, you can call any endpoint after /api/ and it will be passed through the above function only. For example,
http://localhost:3000/api/,
http://localhost:3000/api/,
http://localhost:3000/api/v1,
http://localhost:3000/api/v1,
.http://localhost:3000/api/user/path, etc
.http://localhost:3000/api/user/path, etc
C:\home\node>> node appRoute.js
Server listening on PORT 3000
All others are called
GET is called
SQL ALTER TABLE Statement

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
The ALTER TABLE statement is also used to add and drop various constraints on 
an existing table.
To add a column in a table, use the following syntax:
The following SQL adds an "Email" column to the "Customers" table:
To delete a column in a table, use the following syntax (notice that some 
database systems don't allow deleting a column):
The following SQL deletes the "Email" column from the "Customers" table:
To change the data type of a column in a table, use the following syntax:
SQL Server / MS Access:
My SQL / Oracle (prior version 10G):
Oracle 10G and later:
Look at the "Persons" table:
Now we want to add a column named "DateOfBirth" in the "Persons" table.
We use the following SQL statement:
Notice that the new column, "DateOfBirth", is of type date and is going to hold a 
date. The data type specifies what type of data the column can hold. For a complete 
reference of all the data types available in MS Access, MySQL, and SQL Server, 
go to our complete Data Types reference.
The "Persons" table will now look like this:
Now we want to change the data type of the column named "DateOfBirth" in the "Persons" table.
We use the following SQL statement:
Notice that the "DateOfBirth" column is now of type year and is going to hold a year in a two- or four-digit format.
Next, we want to delete the column named "DateOfBirth" in the "Persons" table.
We use the following SQL statement:
The "Persons" table will now look like this:
Add a column of type DATE called Birthday.
 Persons
;

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Prolog - Operators

In the following sections, we will see what are the different types of operators in Prolog. Types of the comparison operators and Arithmetic operators.
We will also see how these are different from any other high level language operators, how they are syntactically different, and how they are different in their work. Also we will see some practical demonstration to understand the usage of different operators.
Comparison operators are used to compare two equations or states. Following are different comparison operators −
You can see that the ‘=<’ operator, ‘=:=’ operator and ‘=\=’ operators are syntactically different from other languages. Let us see some practical demonstration to this.
| ?- 1+2=:=2+1.

yes
| ?- 1+2=2+1.

no
| ?- 1+A=B+2.

A = 2
B = 1

yes
| ?- 5<10.

yes
| ?- 5>10.

no
| ?- 10=\=100.

yes
Here we can see 1+2=:=2+1 is returning true, but 1+2=2+1 is returning false. This is because, in the first case it is checking whether the value of 1 + 2 is same as 2 + 1 or not, and the other one is checking whether two patterns ‘1+2’ and ‘2+1’ are same or not. As they are not same, it returns no (false). In the case of 1+A=B+2, A and B are two variables, and they are automatically assigned to some values that will match the pattern.
Arithmetic operators are used to perform arithmetic operations. There are few different types of arithmetic operators as follows −
Let us see one practical code to understand the usage of these operators.
calc :- X is 100 + 200,write('100 + 200 is '),write(X),nl,
        Y is 400 - 150,write('400 - 150 is '),write(Y),nl,
        Z is 10 * 300,write('10 * 300 is '),write(Z),nl,
        A is 100 / 30,write('100 / 30 is '),write(A),nl,
        B is 100 // 30,write('100 // 30 is '),write(B),nl,
        C is 100 ** 2,write('100 ** 2 is '),write(C),nl,
        D is 100 mod 30,write('100 mod 30 is '),write(D),nl.
Note − The nl is used to create new line.
| ?- change_directory('D:/TP Prolog/Sample_Codes').

yes
| ?- [op_arith].
compiling D:/TP Prolog/Sample_Codes/op_arith.pl for byte code...
D:/TP Prolog/Sample_Codes/op_arith.pl compiled, 6 lines read - 2390 bytes written, 11 ms

yes
| ?- calc.
100 + 200 is 300
400 - 150 is 250
10 * 300 is 3000
100 / 30 is 3.3333333333333335
100 // 30 is 3
100 ** 2 is 10000.0
100 mod 30 is 10

yes
| ?-


    65 Lectures 
     5 hours 

 Arnab Chakraborty

    78 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
Chef - Workstation Setup

Chef follows the concept of client-server architecture, hence in order to start working with Chef one needs to set up Chef on the workstation and develop the configuration locally. Later it can be uploaded to Chef server to make them working on the Chef nodes, which needs to be configured.
Opscode provides a fully packaged version, which does not have any external prerequisites. This fully packaged Chef is called the omnibus installer.
Step 1 − Download the setup .msi file of chefDK on the machine.
Step 2 − Follow the installation steps and install it on the target location.
The setup will look as shown in the following screenshot.
$ echo $PATH 
/c/opscode/chef/bin:/c/opscode/chefdk/bin: 

In order to set up on the Linux machine, we need to first get curl on the machine.
Step 1 − Once curl is installed on the machine, we need to install Chef on the workstation using Opscode’s omnibus Chef installer.
$ curl –L https://www.opscode.com/chef/install.sh | sudo bash 

Step 2 − Install Ruby on the machine.
Step 3 − Add Ruby to path variable.
$ echo ‘export PATH = ”/opt/chef/embedded/bin:$PATH”’ ≫ ~/.bash_profile && 
source ~/.bash_profile 

The Omnibus Chef will install Ruby and all the required Ruby gems into /opt/chef/embedded by adding /opt/chef/embedded/bin directory to the .bash_profile file.
If Ruby is already installed, then install the Chef Ruby gem on the machine by running the following command.
$ gem install chef 

 Print
 Add Notes
 Bookmark this page
SQL Tryit Editor v1.6

SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country
HAVING COUNT(CustomerID) > 5;
​
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, Opera, and Edge(79).
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
tolower() function in C - GeeksforGeeks

17 Dec, 2021
The tolower() function is defined in the ctype.h header file. If the character passed is an uppercase alphabet then the tolower() function converts an uppercase alphabet to a lowercase alphabet.Syntax:  
int tolower(int ch);
Parameter: This method takes a mandatory parameter ch which is the character to be converted to lowercase.Return Value: This function returns the lowercase character corresponding to the ch.Below programs illustrate the tolower() function in C:Example 1:- 
c
// C program to demonstrate// example of tolower() function. #include <ctype.h>#include <stdio.h> int main(){     // Character to be converted to lowercase    char ch = 'G';     // convert ch to lowercase using toLower()    printf("%c in lowercase is represented as = %c", ch, tolower(ch));     return 0;}
G in lowercase is represented as = g
 
Example 2:- 
c
// C program to demonstrate// example of tolower() function. #include <ctype.h>#include <stdio.h> int main(){    int j = 0;    char str[] = "GEEKSFORGEEKS\n";     // Character to be converted to lowercase    char ch = 'G';     // convert ch to lowercase using toLower()    char ch;     while (str[j]) {        ch = str[j];         // convert ch to lowercase using toLower()        putchar(tolower(ch));         j++;    }     return 0;}
geeksforgeeks
 
Note:  
If the character passed in the tolower() is any of these three
1. lowercase character
2. special symbol
3. digit
tolower() will return the character as it is.
Example :
C
// C program to demonstrate// example of tolower() function.#include <ctype.h>#include <stdio.h> int main(){    int j = 0;    char str[] = "GeEks@123\n";    char ch;     while (str[j]) {        ch = str[j];        putchar(tolower(ch));        j++;    }     return 0;}// code is contributed by codersaty
geeks@123

CoderSaty
C-Functions
C-Library
C-String
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Multidimensional Arrays in C / C++
Command line arguments in C/C++
rand() and srand() in C/C++
fork() in C
Core Dump (Segmentation fault) in C/C++
Left Shift and Right Shift Operators in C/C++
TCP Server-Client implementation in C
Exception Handling in C++
Different methods to reverse a string in C/C++
Function Pointer in C
What is double address operator(&&) in C++?

&& is a new reference operator defined in the C++11 standard. int&& a means "a" is an r-value reference. && is normally only used to declare a parameter of a function. And it only takes an r-value expression.
Simply put, an r-value is a value that doesn't have a memory address. E.g. the number 6, and character 'v' are both r-values. int a, a is an l-value, however (a+2) is an r-value.
void foo(int&& a)
{
   //Some magical code...
}
int main()
{
   int b;
   foo(b);       //Error. An rValue reference cannot be pointed to a lValue.
   foo(5);       //Compiles with no error.
   foo(b+3);     //Compiles with no error.
   int&& c = b;  //Error. An rValue reference cannot be pointed to a lValue.
   int&& d = 5;  //Compiles with no error.
}
You can read more about R-values and this operator at http://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx
jQuery :parent Selector

The :parent selector in jQuery is used to select all elements that are the parent of another element.
The syntax is as follows −
$(":parent")
Let us now see an example to implement the jQuery :parent selector −
<!DOCTYPE html>
<html>
<head>
<style>
   .one {
      background-color: blue;
      color: white;
      font-size: 18px;
      border: 2px blue dashed;
   }
</style>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script>
   $(document).ready(function(){
      $("th:parent").addClass("one");
   });
</script>
</head>
<body>
<h2>Result</h2>
<table border="1">
<tr>
<th>Rank</th>
<th></th>
<th>Player</th>
</tr>
<tr>
<td>1</td>
<td>100</td>
<td>Virat Kohli</td>
</tr>
<tr>
<td>2</td>
<td>80</td>
<td>Steve Smith</td>
</tr>
<tr>
<td>3</td>
<td>75</td>
<td>David Warner</td>
</tr>
<tr>
<td>4</td>
<td>60</td>
<td>Kane Williamson</td>
</tr>
<tr>
<td>5</td>
<td>50</td>
<td>Ben Stokes</td>
</tr>
<tr>
<td>6</td>
<td>45</td>
<td>Rohit Sharma</td>
</tr>
</table>
</body>
</html>
This will produce the following output −
Count all Palindromic Subsequence in a given String in C++

In this tutorial, we will be discussing a program to find the number of all palindromic subsequences in a given string.
For this we will be provided with a string. Our task is to find the number of palindromic subsequences that can be made in that given string.
#include<iostream>
#include<cstring>
using namespace std;
//returning total palindromic sequence
int count_palin(string str){
   int N = str.length();
   //creating a 2D array
   int cps[N+1][N+1];
   memset(cps, 0 ,sizeof(cps));
   for (int i=0; i<N; i++)
      cps[i][i] = 1;
   for (int L=2; L<=N; L++){
      for (int i=0; i<N; i++){
         int k = L+i-1;
         if (str[i] == str[k])
            cps[i][k] = cps[i][k-1] + cps[i+1][k] + 1;
         else
            cps[i][k] = cps[i][k-1] + cps[i+1][k] - cps[i+1][k-1];
      }
   }
   return cps[0][N-1];
}
int main(){
   string str = "abcb";
   cout << "Total palindromic subsequence are : " << count_palin(str) << endl;
   return 0;
}
Total palindromic subsequence are : 6
Using sy-datum low and high in ABAP Program

In this code, you have used ‘BT’ i.e. between so select option will hit any date between today and YYYYMMDD ‘99991231’.
You should declare high dates at INITIALIZATION so that it is visible on the selection screen and you can change it if required.
select-OPTIONS: so_date FOR sy-datum.
INITIALIZATION.
   so_date-sign = 'I'.
   so_date-option = 'BT'.
   so_date-low = sy-datum.
   so_date-high = '99991231'.
APPEND so_date.
How to create a boxplot using ggplot2 with aes_string in R?

To create a boxplot using ggplot2 with aes_string in R, we can follow the below steps −
First of all, create a data frame with one string and one numerical column.
Then, use aes_string function of ggplot2 package to create the boxplot.
Let's create a data frame as shown below −
 Live Demo
X<-sample(LETTERS[1:4],20,replace=TRUE)
Count<-sample(1:50,20)
df<-data.frame(X,Count)
df
On executing, the above script generates the below output(this output will vary on your
system due to randomization) −
 X Count
1 A 12
2 B 41
3 A 5
4 A 42
5 C 26
6 D 14
7 D 20
8 B 37
9 A 46
10 D 31
11 A 7
12 D 28
13 B 40
14 D 47
15 D 49
16 D 3
17 C 11
18 D 44
19 B 24
20 B 2
Loading ggplot2 package and creating boxplot using aes_string function −
X<-sample(LETTERS[1:4],20,replace=TRUE)
Count<-sample(1:50,20)
df<-data.frame(X,Count)
library(ggplot2)
ggplot(data=df,aes_string(x="X",y="Count"))+geom_boxplot()
Java strictfp keyword

strictfp is used to ensure that floating points operations give the same result on any platform. As floating points precision may vary from one platform to another. strictfp keyword ensures the consistency across the platforms.
strictfp can be applied to class, method or on interfaces but cannot be applied to abstract methods, variable or on constructors.
Following are the valid examples of strictfp usage.
strictfp class Test {
}
strictfp interface Test {
}
class A {
   strictfp void Test() {
   }
}
Following are the invalid strictfp usage.
class A {
   strictfp float a;
}
class A {
   strictfp abstract void test();
}
class A {
   strictfp A() {
   }
}
PHP break statement and continue Example - onlinetutorialspoint

PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
In this tutorial, we are going to learn about PHP break statement and continue and those importances.
A break statement is useful when we want to exit from a loop without completing the iteration.
The keyword break is used universally to get out of loops in PHP. It works for the for, foreach, switch statements, and while statements.
<?php
$apples = array(100, 200, 1100, 300, 600);
$v1 = 0;
$sum = 0;
while ($v1 <= 5) {
if ($sum > 1400) {
break;
}
$sum = $sum + $apples[$v1];
$v1 = $v1 + 1;
}
echo $sum;
?>
Output:
1700
On the above example, the break statement is executed when ever the $sum value is greater then 1400.
This statement is used when the developer directs control to the beginning of a loop, effectively skipping other statements inside the loop.
The keyword continue is used. It is also associated with the if statements.
<?php

$x = 1;
echo 'even numbers upto 10<br />';
while ($x <= 10) {
if ($x % 2) {
$x++;
continue;
} else {
echo $x . '<br />';
$x++;
}
}
Output:
even numbers upto 10
2
4
6
8
10
Happy Learning 🙂

PHP Echo Vs Print Example Tutorials
PHP Variables Example Tutorials
PHP for Loop foreach Example Tutorials
String in Switch in Java 7 Example
PHP Array Example Tutorials
PHP Superglobals Example Tutorials
PHP switch Statement Example Tutorials
PHP Operators Example Tutorials
PHP Array Sort Techniques Tutorials
What are the List of Python Keywords
PHP Data types Example Tutorials
PHP String functions Example Tutorials
PHP Functions Example Tutorials
PHP if Statement Example Tutorials
Python if statement Example

PHP Echo Vs Print Example Tutorials
PHP Variables Example Tutorials
PHP for Loop foreach Example Tutorials
String in Switch in Java 7 Example
PHP Array Example Tutorials
PHP Superglobals Example Tutorials
PHP switch Statement Example Tutorials
PHP Operators Example Tutorials
PHP Array Sort Techniques Tutorials
What are the List of Python Keywords
PHP Data types Example Tutorials
PHP String functions Example Tutorials
PHP Functions Example Tutorials
PHP if Statement Example Tutorials
Python if statement Example
How can we create a MySQL view with LEFT JOIN?

To illustrate the making of MySQL view with LEFT JOIN we are using the following data from ‘Customers’ and ‘Resreve’ tables −
mysql> Select * from customers;
+-------------+----------+
| Customer_Id | Name     |
+-------------+----------+
| 1           | Rahul    |
| 2           | Yashpal  |
| 3           | Gaurav   |
| 4           | Virender |
+-------------+----------+
4 rows in set (0.00 sec)

mysql> Select * from reserve;
+------+------------+
| ID   | Day        |
+------+------------+
| 1    | 2017-12-30 |
| 2    | 2017-12-28 |
| 2    | 2017-12-25 |
| 1    | 2017-12-24 |
| 3    | 2017-12-26 |
+------+------------+
5 rows in set (0.00 sec)
Now following query will create a view named ‘customer_VLeft’, using LEFT JOIN on the above-mentioned tables, which would have the names of the customers who have not made the reservation for any of the car.
mysql> Create view customer_Vleft AS SELECT NAME from customers LEFT JOIN RESERVE ON customer_id = id WHERE id IS NULL;
Query OK, 0 rows affected (0.13 sec)

mysql> Select * from customer_Vleft;
+----------+
| NAME     |
+----------+
| Virender |
+----------+
1 row in set (0.00 sec)
How to change the font on ttk.Entry in Tkinter?

There are times when a user wants to insert the information like Name, contact number, Email, address, etc. Tkinter has a simple way to handle these types of inputs through its Entry widgets. Tkinter Entry widgets can be styled using the ttk package.
To change other properties of the Entry widgets such as font properties, text-size, and font-style, we can use the font(‘font-family font-size font-style’) attribute. We can specify the font property in the entry constructor.
#Import tkinter library
from tkinter import *
from tkinter import ttk
#Create an instance of tkinter frame or window
win= Tk()
#Set the geometry of tkinter frame
win.geometry("750x250")
#Create an Entry Widget
entry= ttk.Entry(win,font=('Century 12'),width=40)
entry.pack(pady= 30)
win.mainloop()
Executing the above code will display a window that contains a customized Entry widget.
To change the font property, we can modify the values of the font attributes in the code.
Check if all elements of the array are palindrome or not in Python

Suppose we have a list of numbers nums. We have to check whether the list is palindrome or not.
So, if the input is like nums = [10, 12, 15, 12, 10], then the output will be True.
To solve this, we will follow these steps −
n := size of nums
reset is_palindrome
i := 0
while i <= quotient of (n / 2) and n is not 0, doif nums[i] is not same as nums[n - i - 1], thenset is_palindromecome out from the loopi := i + 1
if nums[i] is not same as nums[n - i - 1], thenset is_palindromecome out from the loop
set is_palindrome
come out from the loop
i := i + 1
if is_palindrome is set, thenreturn False
return False
otherwise,return True
return True
Let us see the following implementation to get better understanding −
 Live Demo
def solve(nums):
   n = len(nums)
   is_palindrome = 0
   i = 0
   while i <= n // 2 and n != 0:
      if nums[i] != nums[n - i - 1]:
         is_palindrome = 1
         break
      i += 1
   if is_palindrome == 1:
      return False
   else:
      return True
nums = [10, 12, 15, 12, 10]
print(solve(nums))
[10, 12, 15, 12, 10]
True
How to use method references with Generics in Java?

The method references are introduced in Java 8 similar to lambda expression. It can allow us to reference methods or constructors without executing them. The method references and lambda expressions require a target type that consists of a compatible functional interface. We can also use a method reference with generic classes and generic methods in java.
interface MyFunc<T> {
   int func(T[] vals, T v);
}
class MyArrayOps {
   static<T> int countMatching(T[] vals, T v) {
      int count = 0;
      for(int i=0; i < vals.length; i++)
         if(vals[i] == v)
            count++;
      return count;
   }
}
public class GenericMethodRefTest {
   static<T> int myOp(MyFunc f, T[] vals, T v) {
      return f.func(v als, v);
   }
   public static void main(String args[]) {
      Integer[] vals = { 1, 2, 3, 4, 2, 3, 4, 4, 5 };
      String[] strs = { "One", "Two", "Three", "Two" };
      int count;
      count = myOp(MyArrayOps :: countMatching, vals, 4);
      System.out.println("vals contains " + count + " 4s");
      count = myOp(MyArrayOps :: countMatching, strs, "Two");
      System.out.println("strs contains " + count + " Twos");
   }
}
vals contains 3 4s
strs contains 2 Twos
What is Logical AND Operator (&&) in JavaScript?

If both the operands are non-zero, then the condition becomes true with Logical AND Operator.
You can try to run the following code to learn how to work with Logical ANDOperator −
<html>
   <body>
      <script>
         var a = true;
         var b = false;

         document.write("(a && b) => ");
         result = (a && b);
         document.write(result);
      </script>
   </body>
</html>