Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Roles and Stored Procs II Oracle
  • Follwoing korn shell is used to move files from source folder to destination folder and gzip it in destination folder. mv_iotto.ksh Linux/Unix
  • cp_filesystem.sql Oracle
  • create user with unlimited quota Oracle
  • fdisk -l explaination about Primary-Logical-Extended Partitions Linux/Unix
  • Oracle Metalink useful notes Oracle
  • grep multuple patterns Linux/Unix
  • Oracle Material from OTN Oracle
  • To see mem usage and CPU usage system wide. Linux/Unix
  • replace alphabets using sed Linux/Unix
  • catting.sh Linux/Unix
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Display the top 5 salaries for each department using single SQL Oracle
  • Good Doc 28-JUN-2006 Oracle
  • sqlnet.ora paramters Oracle

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook
# Databricks notebook source

 

%sql
create database if not exists abcdb

 

%sql
use abcdb

 

%sql
create table student (id int , name string)

 

%sql
insert into student
select 1 as id, ‘user1’ as name

 

%sql
select * from student

 

spark.sql(“create database if not exists xyzdb”)
spark.sql(“use xyzdb”)

 

# Use three double quotes (“””) if SQL you are using has multiple lines.
spark.sql(“”” create table student1
        ( id int,
        name string )”””)

 

spark.sql(“”” insert into student1
        select 2 as id, ‘test1’ as name””” )

 

# Different format of printing or displaying dataframe.

# Selecting rows from dataframe
spark.sql(“select * from student1”).display()
spark.sql(“select * from student1”).show()

# Storing result-set in collection
spark.sql(“select * from student1”).collect

# Describe schema and datatype
spark.sql(“select * from student1”).printSchema()

 
Python/PySpark

Post navigation

Previous Post: Read CSV file using PySpark
Next Post: Add new columns in dataframe

Related Posts

  • Add new columns in dataframe Python/PySpark
  • Python class import from different folders Python/PySpark
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Reading config file from other folder inside class Python/PySpark
  • Read CSV File using Python Python/PySpark
  • Read CSV file using PySpark Python/PySpark

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (387)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (336)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024
  • Add new columns in dataframe30-Sep-2023

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • executing Function from SQLPLUS prompt Oracle
  • backspace in SQL Plus not working then..? Linux/Unix
  • scripts to take listener.log backup Linux/Unix
  • find_cons.sql Oracle
  • Goldengate Tutorial Oracle
  • ORA-00064: object is too large to allocate on this O/S during startup Oracle
  • eplan.sql Oracle
  • Jai Shree Ram Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme