OpenGL: Can you use a mixture of old and new OpenGL functions?

Like this, for example:

	public void initialize() {
		try {
			Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
			Display.setTitle("Test");
			Display.create();
		}
		catch (LWJGLException e) {
			e.printStackTrace();
		}
	}
	
	public void start() {
		Random random = new Random();
		while (!Display.isCloseRequested()) {
			GL11.glViewport(0, 0, WIDTH, HEIGHT);
			GL11.glClearColor(random.nextFloat(), random.nextFloat(), random.nextFloat(), 1.0f);
			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
			
			//...
			//Some other codes irrelevant to this in-between these commented periods.
			//...
			
			int vertexShader = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
			GL20.glShaderSource(vertexShader, vertexShaderCode);
			GL20.glCompileShader(vertexShader);
			//...etc.
			
			
			//...
			
			Display.update();
			Display.sync(60);
		}
	}

And possible go from GL20 to GL30 and back to GL20, etc.? I know some functions were deprecated, but what if you can reuse old specifications and put them together in the new specifications of a program?