Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Query to Generate aggregate on every 30 mins. Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • How to collect CPU usage on Linux using Shell script Linux/Unix
  • kill all processes from specific user in solaris. Linux/Unix
  • Search and replace editor command in vi Linux/Unix
  • Export Oracle data and Compress at same time Oracle
  • OEM-Commnds Oracle
  • Flowers Resize datafiles Oracle
  • Find long Running Transaction Linux/Unix
  • Another export with Query Oracle
  • note id 373303.1 Linux/Unix
  • Settting up get_vmstat.sh for colletinf CPU Usage. Oracle
  • Drop tempfiles from database Oracle
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • How to find password change date for user 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

  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Read CSV file using PySpark Python/PySpark
  • Python class import from different folders Python/PySpark
  • Reading config file from other folder inside class Python/PySpark
  • Read CSV File using Python Python/PySpark
  • Add new columns in dataframe 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 (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • 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

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Export Import with QUERY Oracle
  • plan10g.sql good1 Oracle
  • Generate SSH without password authentication. Linux/Unix
  • Python class import from different folders Python/PySpark
  • Rollback force for distributed transactions Oracle
  • get_vmstat_linux Oracle
  • How to hide author name in WordPress BLOG PHP/MYSQL/Wordpress
  • SQL_PLAN.sql for checking real execution plan Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme